The NA62 experiment at CERN, configured in beam-dump mode, has searched for dark photon decays in flight to electron-positron pairs using a sample of 1.4×10^{17} protons on dump collected in 2021. No evidence for a dark photon signal is observed. The combined result for dark photon searches in lepton-antilepton final states is presented and a region of the parameter space is excluded at 90% confidence level, improving on previous experimental limits for dark photon mass values between 50 and 600 MeV/c^{2} and coupling values in the range 10^{-6} to 4×10^{-5}. An interpretation of the e^{+}e^{-} search result in terms of the emission and decay of an axionlike particle is also presented.