Prediction of fine particulate matter with particle size less than 2.5 µm (PM2.5) is an important component of atmospheric pollution warning and control management. In this study, we propose a deep learning model, namely, a spatiotemporal weighted neural network (STWNN), to address the challenge of poor long-term PM2.5 prediction in areas with sparse and uneven stations. The model, which is based on convolutional neural network–bidirectional long short-term memory (CNN–Bi-LSTM) and attention mechanisms and uses a geospatial data-driven approach, considers the spatiotemporal heterogeneity effec It is correct.ts of PM2.5. This approach effectively overcomes instability caused by sparse station data in forecasting daily average PM2.5 concentrations over the next week. The effectiveness of the STWNN model was evaluated using the Xinjiang Uygur Autonomous Region as the study area. Experimental results demonstrate that the STWNN exhibits higher performance (RMSE = 10.29, MAE = 6.4, R2 = 0.96, and IA = 0.81) than other models in overall prediction and seasonal clustering. Furthermore, the SHapley Additive exPlanations (SHAP) method was introduced to calculate the contribution and spatiotemporal variation of feature variables after the STWNN prediction model. The SHAP results indicate that the STWNN has significant potential in improving the performance of long-term PM2.5 prediction at the regional station level. Analyzing spatiotemporal differences in key feature variables that influence PM2.5 provides a scientific foundation for long-term pollution control and supports emergency response planning for heavy pollution events.