Heavy-metal contamination in agricultural soil, particularly of cadmium (Cd), poses serious threats to soil biodiversity, rice production, and food safety. Soil microbes improve soil fertility by regulating soil organic matter production, plant nutrient accumulation, and pollutant transformation. Addressing the impact of Cd toxicity on soil fungal community composition, soil health, and rice yield is urgently required for sustainable rice production. Vermicompost (VC) is an organic fertilizer that alleviates the toxic effects of Cd on soil microbial biodiversity and functionality and improves crop productivity sustainably. In the present study, we examined the effects of different doses of VC (i.e., 0, 3, and 6 tons ha-1) and levels of Cd stress (i.e., 0 and 25 mg Cd kg-1) on soil biochemical attributes, soil fungal community composition, and fragrant-rice grain yield. The results showed that the Cd toxicity significantly reduced soil fertility, eukaryotic microbial community composition and rice grain yield. However, the VC addition alleviated the Cd toxicity and significantly improved the soil fungal community; additionally, it enhanced the relative abundance of Ascomycota, Chlorophyta, Ciliophora, Basidiomycota, and Glomeromycta in Cd-contaminated soils. Moreover, the VC addition enhanced the soil's chemical attributes, including soil pH, soil organic carbon (SOC), available nitrogen (AN), total nitrogen (TN), and microbial biomass C and N, compared to non-VC treated soil under Cd toxicity conditions. Similarly, the VC application significantly increased rice grain yield and decreased the Cd uptake in rice. One possible explanation for the reduced Cd uptake in plants is that VC amendments influence the soil's biological properties, which ultimately reduces soil Cd bioavailability and subsequently influences the Cd uptake and accumulation in rice plants. RDA analysis determined that the leading fungal species were highly related to soil environmental attributes and microbial biomass C and N production. However, the relative abundance levels of Ascomycota, Basidiomycota, and Glomeromycta were strongly associated with soil environmental variables. Thus, the outcomes of this study reveal that the use of VC in Cd-contaminated soils could be useful for sustainable rice production and safe utilization of Cd-polluted soil.