In order to optimize the allocation of reactive power compensation in distribution networks with high penetration of renewable energy, it is important to establish an effective and accurate carbon reduction contribution accounting method. Firstly, the initial scene set is generated by the probability distribution model, and then the typical scene set is established by using the scene reduction clustering method, then, the compensation position and the compensation capacity of the reactive power compensation equipment are determined by the secondary exact moment of reactive power, taking the minimum installation cost and the minimum node voltage deviation as the objective functions. Finally, taking IEEE-33 node distribution system as an example, the model is solved by using Python algorithm, the results show that the proposed method can effectively optimize reactive power compensation allocation for distribution networks with distributed power supply.