A search for direct pair production of scalar partners of the top quark (top squarks or scalar third-generation up-type leptoquarks) in the all-hadronic tt¯ plus missing transverse momentum final state is presented. The analysis of 139 fb - 1 of s=13 TeV proton–proton collision data collected using the ATLAS detector at the LHC yields no significant excess over the Standard Model background expectation. To interpret the results, a supersymmetric model is used where the top squark decays via t~→t(∗)χ~10, with t(∗) denoting an on-shell (off-shell) top quark and χ~10 the lightest neutralino. Three specific event selections are optimised for the following scenarios. In the scenario where mt~>mt+mχ~10, top squark masses are excluded in the range 400–1250 GeV for χ~10 masses below 200 GeV at 95% confidence level. In the situation where mt~∼mt+mχ~10, top squark masses in the range 300–630 GeV are excluded, while in the case where mt~<mW+mb+mχ~10 (with mt~-mχ~10≥5 GeV), considered for the first time in an ATLAS all-hadronic search, top squark masses in the range 300–660 GeV are excluded. Limits are also set for scalar third-generation up-type leptoquarks, excluding leptoquarks with masses below 1240 GeV when considering only leptoquark decays into a top quark and a neutrino.