Pneumonia is one of the most common and fatal diseases in the world. Early diagnosis and treatment are important factors in reducing mortality caused by the aforementioned disease. One of the most important and common techniques to diagnose pneumonia disease is the X-ray images. By evaluating these images, various machine-learning methods are used for accuracy in diagnosis. The presented study in this article utilizes machine-learning techniques to evaluate these X-ray images. The diagnosis of pediatric pneumonia is classified with a proposed machine learning method by using the chest X-ray images. The proposed system firstly utilizes a two-dimensional discrete wavelet transform to extract features from images. The features obtained from the wavelet method are labeled as normal and pneumonia and applied to the classifier for classification. Besides, Random Forest algorithm is used for the classification technique of 5856 X-ray images. A 10-fold cross-validation method is used to evaluate the success of the proposed method and to ensure that the system avoided overfitting. By using various machine learning algorithms, simulation results reveal that the Random Forest method is proposed and it gives successful results. Results also show that, at the end of the training and validation process, the proposed method achieves higher success with an accuracy of 97.11%.