Spontaneous intracerebral hemorrhage is the second most common subtype of stroke. Therefore, this study aimed to investigate the risk factors affecting the prognosis of patients with basal ganglia cerebral hemorrhage after neuroendoscopy. Between January 2020 and January 2024, 130 patients with basal ganglia cerebral hemorrhage who underwent neuroendoscopy were recruited from two independent centers. We split this dataset into training (n = 79), internal validation (n = 22), and external validation (n = 29) sets. The least absolute shrinkage and selection operator-regression algorithm was used to select the top 10 important radiomic features of different regions (perioperative hemorrhage area [PRH], perioperative surround area [PRS], postoperative hemorrhage area [PSH], and postoperative edema area [PSE]). The black hole, island, blend, and swirl signs were evaluated. The top 10 radiomic features and 4 radiological features were combined to construct the k-nearest neighbor classification (KNN), logistic regression (LR), and support vector machine (SVM) models. Finally, the performance of the perioperative hemorrhage and postoperative edema machine learning models was validated using another independent dataset (n = 29). The primary outcome is mRS at 6 months after discharge. The mRS score greater than 3 defined as functional independence. A total of 12 models were built: PRH-KNN, PRH-LR, PRH-SVM, PRS-KNN, PRS-LR, PRS-SVM, PSH-KNN, PSH-LR, PSH-SVM, PSE-KNN, PSE-LR, and PSE-SVM, with corresponding areas under the curve (AUC) values in the internal validation set of 0.95, 0.91, 0.94, 0.52, 0.91, 0.54, 0.67, 0.9, 0.72, 0.92, 0.92, and 0.95, respectively. The AUC values of the PRH-KNN, PRH-LR, PRH-SVM, PSE-KNN, PSE-LR, and PSE-SVM in the external validation were 0.9, 0.92, 0.89, 0.91, 0.92, and 0.88, respectively. The model built based on computed tomography images of different regions accurately predicted the prognosis of patients with basal ganglia cerebral hemorrhage treated with neuroendoscopy. The models built based on the preoperative hematoma area and postoperative edema area showed excellent predictive efficacy in external verification, which has important clinical significance.