Simultaneous sensing of metabolic analytes such as pH and O2is critical in complex and heterogeneous biological environments where analytes often are interrelated. However, measuring all target analytes at the same time and position is often challenging. A major challenge preventing further progress occurs when sensor signals cannot be directly correlated to analyte concentrations due to additional effects, overshadowing and complicating the actual correlations. In fields related to optical sensing, machine learning has already shown its potential to overcome these challenges by solving nested and multidimensional correlations. Hence, we want to apply machine learning models to fluorescence-based optical chemical sensors to facilitate simultaneous imaging of multiple analytes in 2D. We present a proof-of-concept approach for simultaneous imaging of pH and dissolved O2using an optical chemical sensor, a hyperspectral camera for image acquisition, and a multi-layered machine learning model based on a decision tree algorithm (XGBoost) for data analysis. Our model predicts dissolved O2and pH with a mean absolute error of < 4.50·10−2and < 1.96·10−1, respectively, and a root mean square error of < 2.12·10−1and < 4.42·10−1, respectively. Besides the model-building process, we discuss the potentials of machine learning for optical chemical sensing, especially regarding multi-analyte imaging, and highlight risks of bias that can arise in machine learning-based data analysis.Supplementary InformationThe online version contains supplementary material available at 10.1007/s00216-023-04678-8.