Purpose Identification of morphological characteristics of skin lesions is of vital importance in diagnosing diseases with dermatological manifestations. This task is often performed manually or in an automated way based on intensity level. Recently, ultra-broadband raster-scan optoacoustic mesoscopy (UWB-RSOM) was developed to offer unique cross-sectional optical imaging of the skin. A machine learning (ML) approach is proposed here to enable, for the first time, automated identification of skin layers in UWB-RSOM data. Materials and methods The proposed method, termed SkinSeg, was applied to coronal UWB-RSOM images obtained from 12 human participants. SkinSeg is a multi-step methodology that integrates data processing and transformation, feature extraction, feature selection, and classification. Various image features and learning models were tested for their suitability at discriminating skin layers including traditional machine learning along with more advanced deep learning algorithms. An support vector machines-based postprocessing approach was finally applied to further improve the classification outputs. Results Random forest proved to be the most effective technique, achieving mean classification accuracy of 86.89% evaluated based on a repeated leave-one-out strategy. Insights about the features extracted and their effect on classification accuracy are provided. The highest accuracy was achieved using a small group of four features and remained at the same level or was even slightly decreased when more features were included. Convolutional neural networks provided also promising results at a level of approximately 85%. The application of the proposed postprocessing technique was proved to be effective in terms of both testing accuracy and three-dimensional visualization of classification maps. Conclusions SkinSeg demonstrated unique potential in identifying skin layers. The proposed method may facilitate clinical evaluation, monitoring, and diagnosis of diseases linked to skin inflammation, diabetes, and skin cancer.