In this paper, carboxylated carbon nitride nanoparticles (carboxylated-g-C3N4 NPs) were prepared through a one-step molten salts method. The synthesized material was characterized by transmission electron microscope (TEM), Fourier transform-infrared spectra (FTIR), and X-ray photoelectron spectroscopy (XPS), etc. An electrochemical sensor based on single-stranded oligonucleotide/carboxylated-g-C3N4/chitosan/glassy carbon electrode (ssDNA/carboxylated-g-C3N4/chitosan/GCE) was constructed for determination of the hydroxyl radical (•OH), and methylene blue (MB) was used as a signal molecule. The sensor showed a suitable electrochemical response toward •OH from 4.06 to 122.79 fM with a detection limit of 1.35 fM. The selectivity, reproducibility, and stability were also presented. Application of the sensor to real meat samples (i.e., pork, chicken, shrimp, and sausage) was performed, and the results indicated the proposed method could be used to detect •OH in practical samples. The proposed sensor holds a great promise to be applied in the fields of food safety.