The complexity and severity of brain diseases have led to increased focus on their diagnosis and treatment. Due to the inherent drawbacks of manual medical diagnosis, such as error-prone and costly, and the recent widespread use of Artificial Intelligence (AI) in medicine, it is a worthy topic to explore machine learning in diagnosing brain diseases utilizing Computed Tomography (CT) and Magnetic Resonance Imaging (MRI). In this paper, three brain diseases using CT or MRI datasets from Kaggle were merged and processed, and then three models of decision tree (DT), random forest (RF) and K-Nearest Neighbors (KNN) were used to make classification prediction. Furthermore, their performance was compared through classification reports and confusion matrix to analysis results. The results showed that DT performed worse than the other two models in this task, with an accuracy of 0.91, whereas RF and KNN performed similar overall, each achieving an overall accuracy of 0.96. Notably, RF exhibited less confusion, especially between some similar categories, which indicates the ability of handle complex data more effectively. Additionally, the strengths and weaknesses of the three models are discussed in the paper. These experimental results show that machine learning model, particularly RF and KNN, is a useful tool for diagnosing brain diseases with high accuracy, which could substantially assist clinical practices by providing reliable and efficient diagnostic support.