Selective laser melting (SLM) is an additive manufacturing technique for metallic materials, currently implemented in different industrial applications. Among the various materials, 316L stainless steel (316L SS) has been widely investigated by this process. However, achieving optimal manufacturing quality is challenging due to the large number of parameters that affect the final product. Traditional methods for parameter selection are costly, limited and suboptimal. In this study, several machine learning (ML) approaches were applied to predict the density of 316L SS and optimize SLM process parameters. To predict the density, a critical property for determining the quality of fabricated parts, a comparative study of various ML approaches, including artificial neural network (ANN), support vector machine (SVM) and adaptive boosting (AdaBoost) was established. Our results revealed that the AdaBoost model achieved the best performance and accuracy in density prediction, with a root mean squared error (RMSE) of 1.94 and a mean absolute error (MAE) of 0.98. To optimize the SLM process parameters such as laser power, scan speed, layer thickness and hatch spacing, two primary approaches were employed. The first involves parameter prediction using ML models including ANN, SVM and decision tree regressor (DTR). The second consists of parameter combination generation, using a target material density with a conditional variational autoencoder (CVAE) trained on artificial generated dataset. The second approach showed significant potential for uncovering new parameter spaces and improving the quality of SLM manufactured parts.