Background: Accurate estimation of livestock-based biogas potential is essential for renewable energy planning in agricultural regions with heterogeneous livestock populations and varying microclimatic conditions. Existing studies commonly rely on facility-scale or aggregated datasets with limited spatial resolution, reducing their applicability for regional assessment. Objective: This study aims to develop an accurate, interpretable machine learning framework to predict daily livestock biogas potential at the sub-district level by integrating livestock population, feed management, microclimate variables, and to improve predictive performance through hyperparameter optimization. Methods: A quantitative regression approach was applied using sub-district-level data from West Java, Indonesia. The dataset consisted of 450 validated observations derived from livestock statistics, biogas factors based on the Intergovernmental Panel on Climate Change-based, feed usage indicators, and spatially mapped temperature data. The preprocessing included missing value imputation, outlier handling, and min–max scaling. Eleven regression models were evaluated using K-Fold Cross-Validation. Particle Swarm Optimization (PSO) was used to optimize CatBoost hyperparameters, while interpretability was assessed using SHapley Additive exPlanations (SHAP), Mean Decrease in Impurity, and Permutation Importance. Results: Boosting-based models demonstrated superior predictive performance compared with linear and distance-based methods. The PSO-optimized CatBoost model achieved the highest performance with a coefficient of determination (R²) value of 0.746, Root Mean Square Error (RMSE) of 0.162, and Mean Absolute Error (MAE) of 0.084, outperforming all other models across optimization strategies. The feature importance analysis consistently identified total livestock population, beef cattle population, and average district temperature as the most essential predictors, while feed-related variables moderately contributed to the model predictions. Conclusion: Livestock scale and regional microclimate are key biogas potential determinants. The proposed PSO-optimized CatBoost framework provides an accurate and interpretable approach for estimating livestock-based biogas production, offering useful insights for regional renewable energy planning. Keywords: CatBoost, Feature importance analysis, Livestock biogas prediction, Machine learning, Particle Swarm Optimization