As ionic liquids (ILs) continue to be prepared, there is a growing need to develop theoretical methods for predicting the properties of ILs, such as gas solubility. In this work, different strategies were employed to obtain the solubility of CO2 and N2, where a conductor-like screening model for real solvents (COSMO-RS) was used as the basis. First, experimental data on the solubility of CO2 and N2 in ILs were collected. Then, the solubility of CO2 and N2 in ILs was predicted using COSMO-RS based on the structures of cations, anions, and gases. To further improve the performance of COSMO-RS, two options were used, i.e., the polynomial expression to correct the COSMO-RS results and the combination of COSMO-RS and machine learning algorithms (eXtreme Gradient Boosting, XGBoost) to develop a hybrid model. The results show that the COSMO-RS with correction can significantly improve the prediction of CO2 solubility, and the corresponding average absolute relative deviation (AARD) is decreased from 43.4% to 11.9%. In contrast, such an option cannot improve that of the N2 dataset. Instead, the results obtained from coupling machine learning algorithms with the COSMO-RS model agree well with the experimental results, with an AARD of 0.94% for the solubility of CO2 and an average absolute deviation (AAD) of 0.15% for the solubility of N2.