  We prove a $p$-adic analog of Kunz's theorem: a $p$-adically complete
noetherian ring is regular exactly when it admits a faithfully flat map to a
perfectoid ring. This result is deduced from a more precise statement on
detecting finiteness of projective dimension of finitely generated modules over
noetherian rings via maps to perfectoid rings. We also establish a version of
the $p$-adic Kunz's theorem where the flatness hypothesis is relaxed to almost
flatness.
