BackgroundUnderstanding the intricate relationships between input variables and methane potential is crucial for optimizing anaerobic digestion process after thermal-alkali pre-treatment. This study aimed to optimize low-temperature thermal alkali pre-treatment, focusing on dosage based on the total solids (TS) content of raw sludge. A comparative analysis was conducted to optimize input parameters related to biogas generation potential as the primary response. MethodsBiomethane potential data were collected following the pre-treatment of sludge within the temperature range of 40–70 °C, using various doses of NaOH, KOH, Mg(OH)2, and Ca(OH)2 ranging from 40 mg alkali/g TS to 120 mg alkali/g TS. The optimization of biogas and methane production was conducted through Response Surface Methodology (RSM) and the Random Forest Regressor (RFR) model considering dosage and temperature as input variables. Additionally, sensitivity analysis was performed using the permutation feature importance function to gain insights into the influence of alkali types on biogas and methane production. FindingsThe results obtained from the RFR model showcased a notably high accuracy in predicting optimal solutions. NaOH addition was the most effective pre-treatment with an optimal dose of 65 mg/g TS and at a temperature of 56 °C. NaOH pre-treatment increased methane yield to 414.40 mL/g VS, compared to 117.08 mL/g VS for the untreated sludge. The sensitivity analysis results indicated that the temperature had a more significant effect on biogas potential than the alkali dosage.