The microwave-assisted sol-gel method was used to synthesize mesoporous diatoms (DM) and magnetic mesoporous diatoms (MDM), and used as adsorbent to remove ammonia nitrogen from water. The effect of reaction time, solution pH, and initial concentration of ammonia nitrogen on adsorption was studied, and the adsorption Kinetics and thermodynamic characteristics of DM and MDM were analyzed. The results showed that at 25 °C, when the dosage of DM and MDM was 4 g/L, the initial concentration of ammonia nitrogen in the solution was 50 mg/L, the value of pH was 7, and the adsorption time was 30 min, the adsorption of ammonia nitrogen in solution by DM and MDM was 6.95 and 7.79 mg/g, respectively. DM and MDM had good adsorption effect on ammonia nitrogen, and the adsorption process complied with the Pseudo-second-order kinetics equation and Freundlich isothermal adsorption model.