Partner specificity is a well-known phenomenon in biotic interactions, but little is known about biotic and abiotic factors that determine specificity in plant-fungal associations. Using PacBio sequencing of soils from monospecific and mixed forest stands, we determined the predictors driving partner specificity in both ectomycorrhizal plants and fungi. Fungal guilds differed strongly in the patterns of partner preference and avoidance, and specificity to particular tree genera. Specialist ectomycorrhizal fungi dominated in belowground communities, and most species preferred one of their partner trees - mostly at the plant genus level. Furthermore, all tree genera (sometimes species) displayed preference towards certain fungal groups. Partner specificity was unrelated to rarity of fungi or plants or environmental conditions except soil pH. Depending on partner taxon, specificity in fungi tended to increase with dominance and optimal pH of the partner tree genus and stand age. Partner tree richness and increased evenness of ectomycorrhizal fungi in multi-host communities promotes species richness. However, mainly partner-generalist fungi contribute to the high diversity in mixed forests. Our results further suggest that reforestation with mixed tree species promotes soil biodiversity, and that besides conserving mixed forests, protection of old pure stands may be particularly important for conserving partner-specific ectomycorrhizal fungi.