Air pollution is a serious problem that affects economic development and people’s health, so an efficient and accurate air quality prediction model is needed. In this paper, a combined model is proposed to accurately predict the AQI based on real AQI data from four cities. The model uses an ARIMA model to fit the linear part of the data and a CNN-LSTM model to fit the non-linear part of the data. The Dung Beetle Optimizer algorithm is used to find the hyperparameters of the CNN-LSTM model and determine the optimal hyperparameters. The proposed model is compared with nine other models and the results show that it outperforms the comparison models in terms of root mean square error (RMSE), mean absolute error (MAE) and coefficient of determination (R2).