In recent years, distributed generation (DG) has developed rapidly. Renewable energy, represented by wind energy and solar energy, has been widely studied and utilized. At present, most distributed generators follow the principle of “installation is forgetting” after they are connected to a distribution network. This principle limits the popularization and benefit of distributed generation to a great extent. In order to solve these problems, this paper presents a two-tier model for optimal allocation of distributed power sources in active distribution networks (ADN). The objective of upper level planning is to minimize the annual comprehensive cost of distribution networks, and the objective of lower level planning is to minimize the active power cut-off of distributed generation through active management mode. Taking into account the time series characteristics of load and distributed power output, the improved K-means clustering method is used to cluster wind power and the photovoltaic output in different scenarios to get the daily curves in typical scenarios, and a bilevel programming model of distributed generation based on multiscenario analysis is established under active management mode. The upper level programming model is solved by Quantum genetic algorithm (QGA), and the lower level programming model is solved by the primal dual interior point method (PDIPM). The rationality of the model and the effectiveness of the algorithm are verified by simulation and analysis of a 33-bus distribution network.