Nitrogen (N) shortage poses a great challenge to the implementation of in situ bioremediation practices in mining-contaminated sites. Diazotrophs can fix atmospheric N2 into a bioavailable form to plants and microorganisms inhabiting adverse habitats. Increasing numbers of studies mainly focused on the diazotrophic communities in the agroecosystems, while those communities in mining areas are still not well understood. This study compared the variations of diazotrophic communities in composition and interactions in the mining areas with different extents of arsenic (As) and antimony (Sb) contamination. As and Sb co-contamination increased alpha diversities and the abundance of nifH encoding the dinitrogenase reductase, while inhibited the diazotrophic interactions and substantially changed the composition of communities. Based on the multiple lines of evidence (e.g., the enrichment analysis of diazotrophs, microbe-microbe network, and random forest regression), six diazotrophs (e.g., Sinorhizobium, Dechloromonas, Trichormus, Herbaspirillum, Desmonostoc, and Klebsiella) were identified as keystone taxa. Environment-microbe network and random forest prediction demonstrated that these keystone taxa were highly correlated with the As and Sb contamination fractions. All these results imply that the above-mentioned diazotrophs may be resistant to metal(loid)s.