11A major goal of metacommunity ecology is to infer the local-and regional-scale processes that 12 underlie community assembly. In dendritic ecological networks (e.g., stream metacommunities), 13 branching and directional dispersal connectivity can alter the balance between local and regional 14 factors during assembly. However, the implications of vertical habitat structure (e.g., planktonic 15 versus benthic sediments) in dendritic metacommunities remain unclear. In this study, we 16 analyzed the bacterial metacommunity of a fifth-order mountain stream network to assess habitat 17 differences in the (1) dominant community assembly processes, (2) spatial scaling of community 18 assembly processes, and (3) longitudinal variation in community assembly. Using taxonomic and 19 phylogenetic null modeling approaches, we found habitat-specific spatial patterns of community 20 assembly across the dendritic network. Compositional differences between planktonic and 21 benthic communities were maintained by divergent species sorting, but stochasticity influenced 22 assembly at local scales. Planktonic communities showed scale-dependent assembly, 23 transitioning from convergent sorting at local scales to divergent sorting at regional scales, while 24 sediment community assembly was less scale dependent (convergent sorting remained important 25 across all scales). While divergent sorting structured headwaters in both habitat types, sediment 26 communities converged in structure downstream. Taken together, our results show that vertical 27 habitat structure regulates the scale-dependent processes of community assembly across the 28 dendritic metacommunity. 29