Mine closure operations aim to restore the ecosystem close to its original state. Microorganisms are key components in the soil equilibrium, making them essential in the restoration process. We used metagenomics to identify the bacterial and fungal composition in pristine soils, piled soils (topsoils), enriched piled soils (technosoils), enriched and revegetated soils (revegetated technosoils), and visually distinct pits in an open pit gold mine. We conducted a comparative analysis of ecological similarity between pristine ecosystems with operational and restoration phases. Alpha diversity indices indicated that pristine and topsoils exhibited the highest levels of richness, followed by technosoils and pits. Phylogenetic analysis showed that Proteobacteria and Acidobacteria dominated in most of the soil samples. For fungi, Ascomycota was the most abundant phyla in pristine/topsoils, while Basidiomycota predominated in technosoils. For both bacteria and fungi, the dominant genera differed between pristine/topsoils and technosoils, probably due to the introduction of new microorganisms during amendments and revegetation. Ecological similarity indices showed that topsoil microbial communities were separated from pristine soil, suggesting that they had lost many characteristics. Revegetated technosoil showed more similarities to pristine/topsoil than freshly prepared technosoil, indicating a process of microbial restoration. Within the pit samples, phylogenetic analysis revealed a predominance of the phylum Proteobacteria for bacteria and Ascomycota/Basidiomycota for fungi. All pit samples showed a different genus composition. The ecological similarity analysis shows that the presence of moisture and rock composition is the main axis of dissimilarity in the fungal communities. No pattern of similarity was found for bacteria, suggesting that microbial communities are affected by rock composition. It is concluded that the greater community complexity in soils is related to the availability of nutrients, physicochemical variations and the possibility of interaction with other microbes, while pits could be considered as extreme ecosystems that limit the growth of most microorganisms.