In this study, four machine learning (ML) prediction models were developed to predict and optimize the production performance of caproic acid based on substrates, products, and process parameters. The XGBoost outperformed others, with a high R2 of 0.998 on the training set and 0.885 on the test set. Feature importance analysis revealed hydraulic retention time (HRT) and butyric acid concentration are decisive. The SHAP method offered profound insights into the interplay and cumulative effects of substrate composition, identified the synergistic effects between butyric acid and lactic acid, and emphasized adding glucose can benefit caproic with lactic acid co-fermentation. By integrating the Adaptive Variation Particle Swarm Optimization (AVPSO) algorithm, the optimal process conditions to achieve a maximum caproic acid production of 8.64 g/L was obtained. This study not only advances caproic acid production but contributes a versatile ML-driven strategy applicable to bioprocess optimizations, potentially transformative for sustainable and economically viable bioproduction.