Background: With the popularity of online learning, accurately predicting students’ academic performance and providing personalized interventions have become important demands in education. Objective: The study targets to identify key factors that affect academic performance and accurately predict student academic performance to provide personalized interventions. Methods: Attribution theory was used to analyze the factors affecting academic performance, and a prediction model was constructed using classification and regression tree algorithm and K-means optimization algorithm. Correlation analysis and cluster analysis were used to verify the effectiveness of the model. The accuracy of the classification and regression tree algorithm in the research results reached 0.984, with a recall rate of 0.962. The contour coefficient of the classification and regression tree algorithm was 0.78, and the adjusted Rand index value was 0.85. The mean root mean square error of the model was 0.127, the mean absolute error was 0.089, and the R2 value was 0.892. Results: The outcomes denote that the model can effectively identify key academic influencing factors and accurately predict students’ academic performance. Conclusions: The practical significance of the research lies in providing timely and accurate intervention strategies for educators to enhance students’ academic performance and learning experience in online learning environments.