Carbon dots (CDs) have been widely used in metal-ion detection and are promising candidates for applications in chemical sensors and biomedicine. However, the abundant functional species on the surface of CDs often result in simultaneous response to multiple metal ions and poor selectivity. To realize the selective detection of metal ions, it is crucial to establish the correlation between the surface structure of CDs and metal-ion detection. Herein, CDs with different surface structures were synthesized under harsh thermal microwave reaction. The CDs have citric acid-like, polyethylene glycol-like (PEG-like), or polyethyleneimine-like (PEI-like) surfaces in combination with 4-hydroxy-1H-pyrrolo[3,4-c]pyridine-1,3,6(2H,5H)-trione (HPPT); and amide bonds were found in the lactam structure of HPPT. Different surface species can be distinguished to recognize Fe3+, Cu2+, and Hg2+ ions. Accordingly, organic species of PEG, HPPT, and PEI were used to functionalize carbon nanoparticles to prepare targeting functionalized CDs. The PEG/CDs and HPPT/CDs have high selectivity for Fe3+ and Hg2+ ions, while the PEI/CDs have high selectivity for Cu2+ ions, eliminating the interference of -NH combining Co2+, Mn2+, and Ni2+ ions. Our findings shed light on the correlation between the surface structure of CDs and selective detection of metal ions, which can expand the sensing applications of CDs.