Machine learning models were developed in this study to predict and optimize the medium-chain carbolic acids (MCCAs) production from food waste. All three selected prediction algorithms achieved decent performance (accuracy > 0.85, R2 > 0.707). Three optimization algorithms were applied for MCCA production optimization based on the prediction algorithms. The maximum MCCA production rate (0.68 g chemical oxygen demand per liter per day) was achieved by simulated annealing coupled with random forest under the optimal conditions of pH 8.3, temperature 50 °C, retention time 4 days, loading rate 15.8 g volatile solid per liter per day, and inoculum to food waste ratio 70:30 with semi-continuous mode. Further experiments validated (18 % error) that the MCCA production rate was 113 % higher than the highest production rate of current lab experiments and 60 % higher than the statistical optimization using response surface methodology. This study demonstrates the potential of using machine learning for MCCA production prediction and optimization.