Investigating the influence of biodiversity on ecosystem functioning over environmental gradients is needed to anticipate ecosystem responses to global change. However, our understanding of the functional role of freshwater biodiversity, especially for microbes, is mainly based on manipulative experiments, where biodiversity and environmental variability are minimized. Here, we combined observational and manipulative experiments to analyse how fungal biodiversity responds to and mediates the impacts of drying on two key ecosystem processes: organic matter decomposition and fungal biomass accrual. Our observational data set consists of fungal biodiversity and ecosystem processes from 15 streams spanning a natural gradient of flow intermittence. Our manipulative design evaluates the responses of ecosystem processes to two fungal richness levels crossed with three levels of drying. For the observational experiment, we found that increasing the duration of drying reduced fungal species richness and caused compositional changes. Changes in species composition were driven by species turnover, suggesting resistance mechanisms to cope with drying. We also found that fungal richness had a positive effect on organic matter decomposition and fungal biomass accrual. Positive effects of fungal biodiversity were consistent when controlling for the effects of drying duration on richness by means of structural equation modelling. In addition, our results for the manipulative experiment showed that the positive effects of higher richness on both ecosystem processes were evident even when exposed to short or long simulated drying. Overall, our study suggests that maintaining high levels of biodiversity is crucial for maintaining functional freshwater ecosystems in response to ongoing and future environmental changes.