Searching for new particles beyond the standard model is crucial for understanding several fundamental conundrums in physics and astrophysics. Several hypothetical particles can mediate exotic spin-dependent interactions between ordinary fermions, which enable laboratory searches via the detection of the interactions. Most laboratory searches utilize a macroscopic source and detector, thus allowing the detection of interactions with submillimeter force range and above. It remains a challenge to detect the interactions at shorter force ranges. Here we propose and demonstrate that a near-surface nitrogen-vacancy center in diamond can be utilized as a quantum sensor to detect the monopole–dipole interaction between an electron spin and nucleons. Our result sets a constraint for the electron–nucleon coupling, g_{{mathrm{s}}}^{mathrm{N}}g_{mathrm{p}}^{mathrm{e}}, with the force range 0.1–23 μm. The obtained upper bound of the coupling at 20 μm is g_{{mathrm{s}}}^{mathrm{N}}g_{mathrm{p}}^{mathrm{e}} < 6.24 × 10−15.