To solve the problems of poor corrosion resistance, low adhesion and poor abrasion resistance of general superhydrophobic coatings, A superhydrophobic nano-SiO2/N-doped carbon dots (N-CDs) was prepared on the surface of AZ31B magnesium alloy. The electrolyte consisted of nano-silica particles and N-CDs dispersion, where nano-SiO2 particles were innovatively added to improve the abrasion resistance of the coating. After the superhydrophobic modification by 1H,1H,2H,2H-perfluorooctyltriethoxysilane (PTES), the coating exhibited a water contact angle (WCA) of 154° and a rolling angle (RA) of 7°. The analysis undertaken via potentiodynamic polarization and electrochemical impedance spectroscopy (EIS) demonstrated improved electrochemical performance for the coated magnesium alloy samples when compared with uncoated counterparts. The assemblies formed by the coordination of Mg2+ with the functional groups of N-CD (−NH2, –COOH and –OH) were electrodeposited onto the surface of the magnesium alloy matrix, achieving a dense protective film and thereby slowing down the corrosion rate. At the same time, the abrasion resistance test results indicated that the prepared coating possessed excellent abrasion resistance, possessing the ability to resist damage to the coating caused by friction to a certain extent, proposing a new idea for fabricating superhydrophobic coatings with increased abrasion resistance on Mg alloys.