The critical role of nitrogen (N) in sustaining the vitality of mangrove wetlands is widely recognized, yet research elucidating complex microbiome structures and functional genes driving N biogeochemical cycles are markedly limited. This study leverages high-throughput and metagenomic sequencing to investigate N biogeochemical cycling from the Dongzhai Harbor mangrove wetland. Results reveal that Proteobacteria (29.95–49.26%), Chloroflexi (15.68–35.33%), and Acidobacteria (5.18–12.46%) are the predominant phyla, with Deltaproteobacteria (3.71–7.95%), Gammaproteobacteria (0.83–8.73%), and Alphaproteobacteria (1.73–14.13%) leading at the order level. Microbial diversity and the prevalence of functional genes diminish with increasing sediment depth, indicating that N transformation predominantly occurs in surface sediments. The identified N metabolic pathways in mangrove sediments encompass N fixation (nifD, nifK, nifH genes), nitrification (amoA, amoB, amoC, hao, nxrA and nxrB genes), denitrification (narG, nirK, nirS, norB and nosZ genes), dissimilatory nitrate reduction to ammonium (hzo、hzsA and hzsB genes), and organic N mineralization (gdhA and ureC genes). Organic N mineralization and N fixation are most pronounced in mangrove sediments, with N fixation exhibiting greater intensity in the mangrove than mudflat zone. Salinity, TOC, TN, and SO42- predominantly foster N cycling facilitated by microbial activities, while Fe appears to impede it. These insights offer a scientific foundation for the ecological restoration and conservation of mangrove wetlands.