  A search for the associated production of a heavy resonance with a top-quark
or a top-antitop-quark pair, and decaying into a $t\bar{t}$ pair is presented.
The search uses the data recorded by the ATLAS detector in $pp$ collisions at
$\sqrt{s}= 13$ TeV at the Large Hadron Collider during the years 2015-2018,
corresponding to an integrated luminosity of 139 fb$^{-1}$. Events containing
exactly one electron or muon are selected. The two hadronically decaying top
quarks from the resonance decay are reconstructed using jets clustered with a
large radius parameter of $R=1$. The invariant mass spectrum of the two top
quark candidates is used to search for a resonance signal in the range of 1.0
TeV to 3.2 TeV. The presence of a signal is examined using an approach with
minimal model dependence followed by a model-dependent interpretation. No
significant excess is observed over the background expectation. Upper limits on
the production cross section times branching ratio at 95% confidence level are
provided for a heavy $Z^\prime$ boson based on a simplified model, for
$Z^\prime$ mass between 1.0 TeV and 3.0 TeV. The observed (expected) limits
range from 21 (14) fb to 119 (86) fb depending on the choice of model
parameters.
