  A search for pair production of third-generation scalar leptoquarks decaying
into a top quark and a $\tau$-lepton is presented. The search is based on a
dataset of $pp$ collisions at $\sqrt{s}=13$ TeV recorded with the ATLAS
detector during Run 2 of the Large Hadron Collider, corresponding to an
integrated luminosity of 139 fb$^{-1}$. Events are selected if they have one
light lepton (electron or muon) and at least one hadronically decaying
$\tau$-lepton, or at least two light leptons. In addition, two or more jets, at
least one of which must be identified as containing $b$-hadrons, are required.
Six final states, defined by the multiplicity and flavour of lepton candidates,
are considered in the analysis. Each of them is split into multiple event
categories to simultaneously search for the signal and constrain several
leading backgrounds. The signal-rich event categories require at least one
hadronically decaying $\tau$-lepton candidate and exploit the presence of
energetic final-state objects, which is characteristic of signal events. No
significant excess above the Standard Model expectation is observed in any of
the considered event categories, and 95% CL upper limits are set on the
production cross section as a function of the leptoquark mass, for different
assumptions about the branching fractions into $t\tau$ and $b\nu$. Scalar
leptoquarks decaying exclusively into $t\tau$ are excluded up to masses of 1.43
TeV while, for a branching fraction of 50% into $t\tau$, the lower mass limit
is 1.22 TeV.
