High-temperature corrosion in coal-fired boilers poses a significant threat to safe operation. However, there is currently a lack of effective online monitoring and optimization methods for high-temperature corrosion. Therefore, this study proposes a novel approach to rapidly predict the distribution of chemical species and evaluate high-temperature corrosion degrees, along with optimizing operating conditions to prevent high-temperature corrosion. Firstly, a total of 564 Computational Fluid Dynamics (CFD) simulations are performed on a 330 MW tangentially fired boiler, covering various operating conditions, including coal blending, air distribution, boiler load, etc., to obtain a database of O2, CO, and H2S distributions within the boiler. Then a method based on Proper Orthogonal Decomposition (POD) and Support Vector Regression (SVR) is used to process the database to realize real-time prediction of boiler chemical species distribution, which is next utilized as inputs of a high-temperature corrosion evaluation to obtain in-situ corrosion degree distribution. Finally, Particle Swarm Optimization (PSO) is used to optimize coal blending and air distribution schemes, effectively reducing severe corrosion ratio from 36.34 % to 10.04 % in a typical case by improving the atmosphere near the water walls. This study thus provides a new perspective for online boiler diagnostics and digital twin construction, particularly by achieving online monitoring of high-temperature corrosion and optimizing operating conditions to prevent corrosion.