Clean hydrogen is a key aspect of carbon neutrality, necessitating robust methods for monitoring hydrogen concentration in critical infrastructures like pipelines or power plants. While semiconducting metal oxides such as In2O3 can monitor gas concentrations down to the ppm range, they often exhibit cross-sensitivity to other gases like H2O. In this study, we investigated whether cyclic optical illumination of a gas-sensitive In2O3 layer creates identifiable changes in a gas sensor’s electronic resistance that can be linked to H2 and H2O concentrations via machine learning. We exposed nanostructured In2O3 with a large surface area of 95 m2 g−1 to H2 concentrations (0–800 ppm) and relative humidity (0–70%) under cyclic activation utilizing blue light. The sensors were tested for 20 classes of gas combinations. A support vector machine achieved classification rates up to 92.0%, with reliable reproducibility (88.2 ± 2.7%) across five individual sensors using 10-fold cross-validation. Our findings suggest that cyclic optical activation can be used as a tool to classify H2 and H2O concentrations.