Mesoporous carbon nitride functionalized with melamine-based dendrimer amine has been developed . It has been characterized using N2 adsorption–desorption isotherm, thermogravimetric analysis, Fourier transform spectroscopy and small-angle X-ray scattering techniques. The pore diameter is centered at 4.74 nm with a relatively high BET surface area of 102.2 m2/g with a pore volume of 0.12 cm3/g. Thermogravimetric analysis curves show that the samples (mesoporous carbon nitride and mesoporous carbon nitride functionalized with melamine-based dendrimer amine) have high thermal stability compared to the earlier species. Batch adsorption experiments were conducted to study the effect of adsorbent dose, temperature, contact time and solution pH for the removal of Pb(II) from aqueous systems. The Pb(II) and Cu(II) removal by mesoporous carbon nitride functionalized with melamine-based dendrimer amine was found to be 196.34 and 199.75 mg/g, respectively. The sorption data are correlated better with the Langmuir adsorption isotherm than Freundlich isotherm. The kinetic analysis has revealed that the overall adsorption process is successfully fitted in the pseudo-second-order kinetic model.