Aiming at the problem of low prediction accuracy of existing line loss rate prediction methods, a method combining Stacking ensemble learning model and improved k-means clustering method is proposed to predict the line loss rate in the station area. The data are clustered by clustering method, and the line loss rate of the station area is predicted by Stacking ensemble learning model. Stacking ensemble learning model is composed of XGBoost model, gradient decision tree model and support vector machine model. Compared with the traditional prediction methods, the feasibility is verified by experiments. The results show that compared with the traditional line loss rate prediction method, the proposed prediction method has better prediction effect, higher prediction accuracy and fitting effect. This study provides a certain reference for realizing the double carbon goal of power grid.