Predicting the water quality of industrial boilers is crucial for ensuring operational safety and efficiency. While Long Short-Term Memory (LSTM) neural networks excel at handling extensive temporal data, their parameter selection is not directly determined and often susceptible to local optima. Hence, optimizing these parameters becomes essential. This study aims to propose a water quality prediction algorithm by leveraging the Sparrow Search Algorithm (SSA) to optimize LSTM.By simulating sparrow foraging behavior, SSA iteratively refines LSTM parameters to seek more optimal configurations. The optimized LSTM algorithm is employed for processing water quality data, forming the core of the SSA-LSTM predictive model. Experimental findings reveal that compared to traditional LSTM and CNN-LSTM models, this algorithm demonstrates higher accuracy and reliability in forecasting industrial boiler water quality. Achieving an accuracy of 99.99%, with a Mean Absolute Error (MAE) of 0.001940 and Relative MAE (RMAE) of 0.002083, this research presents an effective method for water quality prediction in the industrial domain. It underscores the potential application value of SSA-LSTM in time series forecasting tasks within industrial settings.