The pursuit of a cost-effective and green synthetic approach to chemical sensors and their application in the sensing of toxic and harmful substances is a never-ending exercise for scientists and researchers. Preparation of fluorescent carbon dots (C-dots) from biomass using water as a solvent and a hydrothermal autoclave to provide the required synthesis temperature offers a cheap and environmentally friendly synthetic approach. Herein, we report a faster, less costly and ecofriendly hydrothermal synthetic approach of carbon dots from Citrullus vulgaris peels as a precursor. The as-prepared carbon dots exhibited hydroxyl, carbonyl and amide functional groups on the surface and an amorphous structure with a particle size distribution of 1.7–3.0 nm. Moreover, the carbon dots displayed intense blue emission fluorescence at 470 nm after excitation at 400 nm. The as-prepared carbon dots demonstrated effective application without further modification towards the selective and sensitive optical recognition of 2-nitrophenol used in the manufacture of explosives. A limit of detection of 2.28×10−7 M was achieved, and no fluorescence quenching was observed in the presence of other nitroaromatic and benzene derivatives indicating excellent selectivity towards 2-nitrophenol. Finally, further studies are required to investigate the potential for the as-prepared carbon dots to monitor nitroaromatic pollutants in real environmental systems.