To solve the problems of high sampling requirements and low predictive accuracy resulting from the complexity, uniqueness, and randomness of predicting the risk of the CO2 and N2 injection to enhance coal seam gas drainage (CO2/N2–ECGD) technology. The principal component analysis (PCA) method to reduce the dimensionality of the factor data that contribute to the effect risk of the technology was adopted. And the particle swarm optimization (PSO) method was implemented to search for optimal hyperparameters in support vector machine (SVM) by particle search, as a solution to the traditional SVM hyperparameters optimization problem. A novel risk prediction model using machine learning algorithms for gas injection displacement technology was constructed. The prediction results were tested and compared with those of backpropagation (BP), Random Forest (RF), and Decision Tree (DT) models using data from 29 gas injection displacement field projects in China. The results demonstrated that the SVM model had greater accuracy in prediction than the other three models. Additionally, after PSO optimization and dimensionality reduction, the PCA–PSO–SVM model reached 100% prediction accuracy, while requiring less modeling and operation time. The study provided a reliable and reasonable model for predicting technical effects, along with a theoretical basis for risk management and prevention. First, the technology's influencing indicators were analyzed by examining its mechanisms. Second, we utilized the PCA method to reduce the dimensionality of the factor data that contribute to the risk of the technology's effects. Third, we implemented the PSO method to search for optimal hyperparameters in the SVM through particle search, as a solution to the traditional SVM hyperparameters optimization problem. Finally, the prediction results were tested and compared with those of BP, RF, and DT models using data from 29 gas injection displacement field projects in China. The SVM model was found to have greater accuracy in prediction than the other three models. After PSO optimization and dimensionality reduction, the PCA–PSO–SVM model achieved 100% prediction accuracy while requiring less modeling and operation time. The study presents a valid and reasonable model for predicting technical effects and a theoretical basis for risk management and prevention.