Additive manufacturing (AM) technologies enable complex, high-value components to be printed, with potential applications in the automotive, aerospace, and biomedical sectors. Porosity in AM processes for metals is a recurrent problem which can lead to adverse effects such as crack initiation and ultimately to parts’ early-life failure. There are several pore classifications described in the literature, which are focused on traditional manufacturing processes. The current lack of information makes it difficult to accurately identify and classify pores in AM-made parts. The present work describes a proposal based on image processing and machine learning, specifically random forests, to classify porosity automatically in metallographic images. The proposed method is divided into 3 stages. (1) Preprocessing stage: image denoising, smoothing, and unblurring to highlight the areas with pores. (2) Feature extraction stage: segmentation of pores and the morphological/geometrical features that describe the porosity. (3) Intelligent classifier stage: definition, training, testing, and validation of the random forest classifier. Our proposal has an accurate balance between the calculation of the feature importance as well as the number to use, the adequate number of trees to grow per forest, and the correct selection of the size of the database. The proposed method achieves an accuracy of 94.41% and out-of-bag error less than 5%. These results guarantee high precision in the porosity classification task. Our approach has the potential to be used in the porosity analysis of any metallic additively manufactured component.