Magnetite affects nitrogen cycle of pig manure (PM) biostabilisation was investigated. Various doses of magnetite (0 % (T1); 2.5 % (T2); 5 % (T3); 7.5 % (T4)) were homogeneously added into PM and wolfberry branch fillings (BF) mixture for a 50-day composting. Compared to T1, total nitrogen (TN) loss in gaseous form increased remarkably by 17.51 %, 56.31 %, and 24.91 %, respectively, in T2–T4. In particular, T3 dramatically increased the cumulative N2O emission but decreased NH3 emissions. However, T2 and T3 enhanced the total nitrogen contents by 7.24 % and 3.09 %. Structural equation models (SEM) analysis indicated that magnetite addition increased the direct and indirect pathways of N2O emission. Further analysis revealed that Ruminofilibacter and N2O emission were significantly correlated, and Pseudomonas played a vital role in nitrogen preservation. Although using 2 % magnetite as an additive could increase the TN content, the obvious increase of N2O emission should be considered in engineering practice.