This research aims to formulate an optimal control algorithm for a hydrothermal air-conditioning system, with the objective of minimizing energy consumption while simultaneously ensuring occupant comfort. Traditional air-conditioning systems often exhibit difficulties in effectively responding to nonlinear dynamic characteristics and variable environmental conditions. Although centralized control strategies can improve energy efficiency, they frequently do not adequately fulfill thermal comfort requirements. To mitigate these challenges, this study introduces an optimal control scheduler that amalgamates machine learning and optimization methodologies, specifically utilizing Random Forest, Gradient Boosting, and Genetic Algorithms. The proposed control scheduler consists of two principal phases. Initially, a forecasting model is constructed using a hybrid approach that integrates Random Forest for predicting water tank temperature and Gradient Boosting for forecasting indoor temperature. In the subsequent phase, an optimization framework is established employing a Genetic Algorithm, aimed at minimizing energy costs and occupant discomfort. This optimization model dynamically adjusts the comfort temperature range based on real-time occupancy estimations, thereby facilitating efficient and adaptive air-conditioning control. The efficacy of the optimal control scheduler was validated in a real-world testbed environment, where its energy efficiency and comfort maintenance were compared to manual control. The findings revealed an 11.41% reduction in energy consumption relative to manual control, alongside an improvement in the comfort maintenance rate from 56.2% to 91.7%, thereby affirming the effectiveness of the proposed approach in enhancing both energy efficiency and thermal comfort.