This letter documents a search for flavour-changing neutral currents (FCNCs), which are strongly suppressed in the Standard Model, in events with a photon and a top quark with the ATLAS detector. The analysis uses data collected in pp collisions at s=13 TeV during Run 2 of the LHC, corresponding to an integrated luminosity of 139 fb−1. Both FCNC top-quark production and decay are considered. The final state consists of a charged lepton, missing transverse momentum, a b-tagged jet, one high-momentum photon and possibly additional jets. A multiclass deep neural network is used to classify events either as signal in one of the two categories, FCNC production or decay, or as background. No significant excess of events over the background prediction is observed and 95% CL upper limits are placed on the strength of left- and right-handed FCNC interactions. The 95% CL bounds on the branching fractions for the FCNC top-quark decays, estimated (expected) from both top-quark production and decay, are B(t→uγ)<0.85(0.88−0.25+0.37)×10−5 and B(t→cγ)<4.2(3.40−0.95+1.35)×10−5 for a left-handed tqγ coupling, and B(t→uγ)<1.2(1.20−0.33+0.50)×10−5 and B(t→cγ)<4.5(3.70−1.03+1.47)×10−5 for a right-handed coupling.