Summary Fungi in stream ecosystems play a critical role in decomposing organic matter. However, despite their ecological importance, few studies have investigated spatial and seasonal variation in lotic fungi. We hypothesised that the taxonomic composition and richness of epilithic fungal assemblages would change along the longitudinal river gradient from headwaters to lower reaches. To test this hypothesis, we examined composition and richness in the Natori River, Japan, using PCR‐DGGE (polymerase chain reaction–denaturing gradient gel electrophoresis). We focused on five phyla of fungi or fungus‐like organisms (Ascomycota, Basidiomycota, Chytridiomycota, Zygomycota and Oomycota) that colonised cobbles to examine effects of dissolved organic matter and nutrients on fungal assemblages. We found that taxonomic richness on cobbles was as high as that on leaf litter and woody debris, suggesting that fungi can grow directly using dissolved organic matter and nutrients in the water, or indirectly via epilithic biofilms. Supporting the hypothesis, taxonomic richness increased longitudinally along the river in autumn, although the within‐site variation in composition on different cobbles was higher in the upper reaches. No spatial differences were detected in spring when spatial heterogeneity in water temperature was low. With the exception of Basidiomycota, nestedness in taxonomic composition was not detected in either spring or autumn, indicating that fungal taxa in the upper reaches are generally replaced by others downstream. These results suggest that taxonomic composition and richness of epilithic fungal assemblages change along the longitudinal gradient of the river, depending on water temperature and spatial differences in abundance and composition of dissolved organic matter and nutrients.