Aiming at the problems of low accuracy and less prediction time step in traditional statistical model for PM2.5 concentration prediction, a PM2.5 concentration prediction method based on deep learning in Internet of Things air monitoring system is proposed. Firstly, the spatiotemporal correlation of each station data in the Internet of Things monitoring system is analyzed, and the cubic spline interpolation method is used to fill in the missing data. Then, the temporal attention of the input data is obtained by attention mechanism, and the feature encoder is used to encode the data to obtain the intermediate features. Finally, the intermediate feature is fused with the historical information of PM2.5 concentration, and the predicted value is obtained through the feature decoder. Using the proposed model to predict the PM2.5 concentration in Beijing, the experimental results show that the long-term PM2.5 predicted value is very close to the real value, and the RMSE and MAE are 17.93 μg/m3 and 11.52 μg/m3, respectively, which are better than other comparison models. So, this model is suitable for multivariable long time series forecasting scenarios.