Urban public transport is a sustainable transportation strategy. Promoting public transport is an important means of urban transport sustainable development. Reasonable operation scheduling can increase the attractiveness of public transit systems and be conducive to the sustainability of transportation systems. Setting headways on a bus route is the key work of bus scheduling. For the refined management requirements of bus scheduling, this paper comprehensively considers the influence of three uncertainties on the bus route headway: passenger demand elasticity, which is an elasticity with respect to the supply of service, the randomness of the bus travel time between bus stops, and the abandoned passengers flow. A bus route headway allocation model is established. Considering the attractiveness of bus traveling and the interests of passengers, the objective functions are the maximum number of passengers waiting for the bus at each stop and the minimum number of passengers who fail to board. An enumeration combining a recursive algorithm under Monte Carlo random simulation conditions is designed to solve the problem. A comparison of the optimal bus departure interval (headway of the origin stop) under different conditions is studied using a numerical case. Under the same conditions, the results show that the model proposed in this paper can reduce the passengers waiting time and attract more passengers traveling by bus and it also meets the goal of sustainable public transport well. These findings are significant references for optimizing bus operations considering these uncertain factors.