We propose and theoretically substantiate a method to study the nonlocal conductivity of two-dimensional electron systems (2DESs) using the tools of near-field microscopy. We show that the height-dependent polarizability of an illuminated near-field probe is substantially different for various transport regimes of charge carriers in a 2DES. For the hydrodynamic transport regime, the polarizability scales as ${z}_{0}^{\ensuremath{-}2}$, where ${z}_{0}$ is the elevation of the probe above the 2DES. Both for Drude and for classical ballistic regimes of conduction, the polarizability scales as ${z}_{0}^{\ensuremath{-}3}$. In the former case, the polarization is carrier density independent, while in the latter it largely depends on carrier density. More generally, we find that the polarizability of the probe is proportional to the Laplace transform of the wave-vector-dependent conductivity and the inverse dielectric function of the 2DES over the wave vectors $q$. Our results should provide a simple tool for studies of nonlocal conductivity in solids, which is challenging to address with other techniques.