Diversity is often implied to have a positive effect on the functional stability of ecological communities. However, its relationship with stochastic and deterministic assembly mechanisms remains largely unknown, particularly under fluctuating disturbances. Here, we subjected complex bacterial communities in microcosms to different frequencies of alteration in substrate feeding scheme, tracking temporal dynamics in their assembly, structure and function. Activated sludge bioreactors were subjected to six different frequencies of double organic loading, either never (undisturbed), every 8, 6, 4, or 2 days (intermediately disturbed), or every day (press disturbed), and operated in daily cycles for 42 days. Null modeling revealed a stronger role of stochastic assembly at intermediate disturbance frequencies, with a peak in stochasticity that preceded the occurrence of a peak in α-diversity. Communities at extreme ends of the disturbance range had the lowest α-diversity and highest within-treatment similarity in terms of β-diversity, with stronger deterministic assembly. Increased carbon removal and microbial aggregate settleability (general functions) correlated with stronger deterministic processes. In contrast, higher stochasticity correlated with higher nitrogen removal (a specialized function) only during initial successional stages at intermediate disturbance frequencies. We show that changes in assembly processes predictably precede changes in diversity under a gradient of disturbance frequencies, advancing our understanding of the mechanisms behind disturbance–diversity–function relationships.