A search for the production of top-quark pairs with the same electric charge ($tt$ or $\bar{t}\bar{t}$) is presented. The analysis uses proton-proton collision data at $\sqrt{s}=13$ TeV, recorded by the ATLAS detector at the Large Hadron Collider, corresponding to an integrated luminosity of 140 fb$^{-1}$. Events with two same-charge leptons and at least two $b$-tagged jets are selected. Neural networks are employed to define two selections sensitive to additional couplings beyond the Standard Model that would enhance the production rate of same-sign top-quark pairs. No significant signal is observed, leading to an upper limit on the total production cross-section of same-sign top-quark pairs of 1.6 fb at 95$\%$ confidence level. Corresponding limits on the three Wilson coefficients associated with the ${\cal O}_{tu}^{(1)}$, ${\cal O}_{Qu}^{(1)}$, and ${\cal O}_{Qu}^{(8)}$ operators in the Standard Model Effective Field Theory framework are derived.