A search for charged Higgs bosons decaying into a top quark and a bottom quark is presented. The data analysed correspond to 139 fb of proton-proton collisions at =13TeV, recorded with the ATLAS detector at the LHC. The production of a heavy charged Higgs boson in association with a top quark and a bottom quark, , is explored in the mass range from 200 to 2000 GeV using final states with jets and one electron or muon. Events are categorised according to the multiplicity of jets and -tagged jets, and multivariate analysis techniques are used to discriminate between signal and background events. No significant excess above the background-only hypothesis is observed and exclusion limits are derived for the production cross-section times branching ratio of a charged Higgs boson as a function of its mass; they range from 3.6 pb at 200 GeV to 0.035 pb at 2000 GeV at 95% confidence level. The results are interpreted in the hMSSM and scenarios.