A search for lepton flavour violating decays of a neutral non-standard-model Higgs boson in the μτ and eτ decay modes is presented. The search is based on proton-proton collisions at a center of mass energy s = 13 TeV collected with the CMS detector in 2016, corresponding to an integrated luminosity of 35.9 fb−1. The τ leptons are reconstructed in the leptonic and hadronic decay modes. No signal is observed in the mass range 200–900 GeV. At 95% confidence level, the observed (expected) upper limits on the production cross section multiplied by the branching fraction vary from 51.9 (57.4) fb to 1.6 (2.1) fb for the μτ and from 94.1 (91.6) fb to 2.3 (2.3) fb for the eτ decay modes.