Although the biogeographical pattern and mechanisms underlying microbial assembly have been well-explored in lentic ecosystems, the relevant scenarios in lotic ecosystems remain poorly understood. By sequencing the bacterial communities in bacterioplankton and biofilm, our study detected their distance-decay relationship (DDR), and the balance between deterministic and stochastic processes, along the Kaidu river in an arid and semi-arid region of northwest China. Our results revealed that bacterioplankton and biofilm had significantly contrasting community structures. The bacterioplankton communities showed a gradually decreasing trend in alpha-diversity from the headwater to the river mouth, contrasting with the alpha-diversity of biofilm communities which was constant along the river length. Both bacterioplankton and biofilm showed significant DDRs along the 500-km river corridor with the slope of the bacterioplankton DDR being steeper than that of the biofilm DDR, which implies a stronger biogeography of bacterioplankton than biofilm. Relative to biofilm communities, the species interactions formed a denser and more complex network in the bacterioplankton communities than in the biofilm communities. Our results also revealed that there was a transition of community assembly from deterministic to stochastic processes upstream to downstream, although both the bacterioplankton and biofilm communities were mainly regulated by deterministic processes within the entire river. All these empirical results expand our knowledge of microbial ecology in an arid and semi-arid lotic ecosystem.