Slope stability analysis is undoubtedly one of the most complex problems in geotechnical engineering and its study plays a paramount role in mitigating the risk associated with the occurrence of a landslide. This problem is commonly tackled by using limit equilibrium methods or advanced numerical techniques to assess the slope safety factor or, sometimes, even the displacement field of the slope. In this study, as an alternative approach, an attempt to assess the stability condition of homogeneous slopes was made using a machine learning (ML) technique. Specifically, a meta-heuristic algorithm (Harmony Search (HS) algorithm) and K-means algorithm were employed to perform a clustering analysis by considering two different classes, depending on whether a slope was unstable or stable. To achieve the purpose of this study, a database made up of 19 case studies with 6 model inputs including unit weight, intercept cohesion, angle of shearing resistance, slope angle, slope height and pore pressure ratio and one output (i.e., the slope safety factor) was established. Referring to this database, 17 out of 19 slopes were categorized correctly. Moreover, the obtained results showed that, referring to the considered database, the intercept cohesion was the most significant parameter in defining the class of each slope, whereas the unit weight had the smallest influence. Finally, the obtained results showed that the Harmony Search algorithm is an efficient approach for training K-means algorithms.