Mountain rivers exert critical ecological effects downstream by retaining or transmitting sediment and nutrients, providing habitat and refuge for diverse aquatic and riparian organisms, and creating migration corridors. River microhabitat heterogeneity (RMH), which plays a key role in ecological restoration and improvement, is sensitive to external disturbances in mountain rivers. However, the effects of RMH, induced by hydro-geomorphological processes, on local macroinvertebrates have not been quantitatively studied. To explore the ecological significance of RMH, we selected five debris flow-dominated mountain rivers (DMR) and five equilibrium sediment transport mountain rivers (EMR) as contrasting examples based on the richness of sediment supply. We measured water depth, flow velocity, and substrate composition in all rivers and proposed a new RMH index (RMHI) for quantitative evaluation of RMH. Macroinvertebrate standing stocks, taxonomic diversity, functional diversity, and functional traits were compared between DMR and EMR. Macroinvertebrate standing stocks in DMRs were about one-third, and α-diversity was half, of those in EMRs. The macroinvertebrate communities exhibited a turnover-dominated pattern in both DMRs and EMRs. Resource availability and utilization efficiency were also smaller in DMRs than in EMRs, which caused a macroinvertebrate community shift from R-strategy to K-strategy. Besides, RMH supported macroinvertebrate α-diversity and functional richness in both DMR and EMR, but debris flow weakened the ecological role of RMH in DMR. Our findings suggested that, in order to maintain the ecological health of mountain rivers, RMHI should be ≥ 8.0. According study results, rivers with greater macroinvertebrate species richness should be managed as a priority for biodiversity conservation by maintaining RMH above its threshold. This could be achieved through the addition of large stones to rivers, which would act to create a large range of riverbed sediment sizes and variable flow regimes, as well as increasing the space available to macroinvertebrates.