A search is presented for lepton-flavor violating decays of the Higgs boson to $\mu\tau$ and e$\tau$. The data set corresponds to an integrated luminosity of 137 fb$^{-1}$ collected at the LHC in proton-proton collisions at a center-of-mass energy of 13 TeV. No significant excess has been found, and the results are interpreted in terms of upper limits on lepton-flavor violating branching fractions of the Higgs boson. The observed (expected) upper limits on the branching fractions are, respectively, $\mathcal{B}($H $\to\mu\tau)$$\lt$ 0.15 (0.15)% and $\mathcal{B}($H$\to$e$\tau)$ $\lt$ 0.22 (0.16)% at 95% confidence level.