Ammonia (NH3) and carbon dioxide (CO2) are the main gases that affect indoor air quality and the health of the chicken flock. Currently, the environmental control strategy for poultry houses mainly relies on real-time temperature, resulting in lag and singleness. Indoor air quality can be improved by predicting the change in CO2 concentration and proposing an optimal control strategy. Combining the advantages of seasonal-trend decomposition using loess (STL), Granger causality (GC), long short-term memory (LSTM), and extreme gradient boosting (XGBoost), an ensemble method called the STL-GC-LSTM-XGBoost model is proposed. This model can set fast response prediction results at a lower cost and has strong generalization ability. The comparative analysis shows that the proposed STL-GC-LSTM-XGBoost model achieved high prediction accuracy, performance, and confidence in predicting CO2 levels under different environmental regulation modes and data volumes. However, its prediction accuracy for NH3 was slightly lower than that of the STL-GC-LSTM model. This may be due to the limited variability and regularity of the NH3 dataset, which likely increased model complexity and decreased predictive ability with the introduction of XGBoost. Nevertheless, in general, the proposed integrated model still provides a feasible approach for gas concentration prediction and health-related risk control in poultry houses.