Aerosols influence weather and climate by interacting with radiation through absorption and scattering. These effects heavily rely on the optical properties of aerosols, which are mainly governed by attributes such as morphology, size distribution, and chemical composition. These attributes undergo continuous changes due to chemical reactions and aerosol micro-physics, resulting in significant spatio-temporal variations. Most atmospheric models struggle to incorporate this variability because they use pre-calculated tables to handle aerosol optics. This offline approach often leads to substantial errors in estimating the radiative impacts of aerosols along with posing significant computational burdens. To address this challenge, we introduce a computationally efficient and robust machine learning approach called MieAI. It allows for relatively inexpensive calculation of the optical properties of internally mixed aerosols with a log-normal size distribution. Importantly, MieAI fully incorporates the variability in aerosol chemistry and microphysics. Our evaluation of MieAI against traditional Mie calculations, using number concentrations from the ICOsahedral Nonhydrostatic model with Aerosol and Reactive Trace gases (ICON-ART) simulations, demonstrates that MieAI exhibits excellent predictive accuracy for aerosol optical properties. MieAI achieves this with errors well within 10%, and it operates more than 1000 times faster than the benchmark approach of Mie calculations. Due to its generalized nature, the MieAI approach can be implemented in any chemistry transport model which represents aerosol size distribution in the form of log-normally distributed internally mixed modes. This advancement has the potential to replace frequently employed look-up tables and plays a substantial role in the ongoing attempts to reduce uncertainties in estimating aerosol radiative forcing.