The rapid development of information technology has led to a huge amount of data generated by large or complex systems and devices. Applications in information technology, medicine, and many other fields generate large volumes of data that challenge analysts. Data mining analysis finds application in areas where statistical and analytical methods and the models built through them are not sufficient. The paper discusses sources of medical data, use cases, and data analysis in medicine, as well as methods and algorithms for data analysis. The purpose and objectives of the study, presented in the paper are to propose an algorithm for processing X-Ray images based on tools and techniques from the field of machine learning. The preprocessing phase is concerned with image transformation, feature extraction, and the selection of training and testing datasets. Preprocessing data enables the processing of data that would not otherwise be appropriate by adjusting the data to the specifications established by each data retrieval procedure. Each feature is examined in the second stage to identify and classify any potential patterns. In the final stage, the most effective model to capture the pattern or behaviour of the data is chosen using a machine learning algorithm. The proposed algorithm is verified using publicly available X-Ray image datasets consisting of four classes: Normal, Lung Opacity, Pneumonia, and COVID-19. A medical image classification workflow was designed for verification. In the experimental workflow, five algorithms in the field of machine learning are determined and implemented: Logistic Regression, Naive Bayes, Random Forest, SVM, and Neural Network. In comparison to the outcomes of Random Forest, Logistic Regression, Naive Bayes, and SVM, the findings of the experimental analysis and results demonstrate that Neural Networks produce the greatest results, and these results can be taken to be the most dependable.