In this work we present a detailed \textit{ab initio} study of the carbonylation reaction of methoxy groups in the zeolite mordenite, as it is the rate determining step in a series of elementary reactions leading to ethanol. For the first time we employ full molecular dynamics simulations to evaluate free energies of activation for the reactions in side pockets and main channels. Results show that the reaction in the side pocket is preferred and, when dispersion interactions are taken into account, this preference becomes even stronger. This conclusion is confirmed using multiple levels of density functional theory approximations with (PBE-D2, PBE-MBD, and vdW-DF2-B86R) or without (PBE, HSE06) dispersion corrections. These calculations, that in principle would require several demanding molecular dynamics simulations, were made possible at a minimal computational cost by using a newly developed approach that combines thermodynamic perturbation theory with machine learning.