Proton-proton interactions resulting in the prodution of a Higgs boson with subsequent decay into two photons are studied in a search for the signature of flavor-changing neutral current interactions of top quarks and Higgs bosons. The analysis is based on data collected at a center-of-mass energy \sqrt{s}=13~\mathrm{TeV} by the CMS detector at the LHC, corresponding to an integrated luminosity of 137~\mathrm{fb}^{-1}. Multivariate machine learning techniques are used to separate signal and standard model background processes. No significant excess above the background prediction is observed, and upper limits on the branching fractions are derived through a binned fit to the diphoton invariant mass spectrum. The observed (expected) confidence level upper limits are found to be () for and () for .