The prediction of methane (CH4) concentration is important for pig farming due to its environmental impact on pigs and farm workers. This study examined the utilization of machine learning algorithms, specifically multiple linear regression (MLR), XGBoost regression (XGB), and random forest regression (RFR), to predict CH4 concentrations in pig barns during the growing-finishing stage of pigs. The dataset included five key input biophysical variables: feed intake (FI), pig mass (MP), carbon dioxide (CO2) levels, temperature (T), and relative humidity (RH). Data was collected from three experimental pig barns during 2022 and 2023 to train and test the machine learning models. Among the three machine learning models, the RFR consistently outperformed both MLR and XGB in predicting CH4 concentrations. The results demonstrated better performance by the RFR model in testing (R2 > 0.81), with improvements in R2 of up to 1.92% and 10.46%, as well as decreases in RMSE of up to 5.74% and 20.51%, compared to the XGB and MLR across the three input datasets. In terms of stability, MLR exhibited the maximum stability, followed by RFR and XGB. Sensitivity analysis found FI to be the most influential input variable for CH4 concentration prediction, with the impact ranking being FI > MP > CO2 > T > RH. This study emphasized the potential of machine learning models, particularly RFR, in predicting CH4 concentrations using relevant input variables. These findings enhance understanding of CH4 concentration, providing useful insights into pig production and environmental management.