High-grade gliomas (HGG) and solitary brain metastases (SBM) are two common types of brain tumors in middle-aged and elderly patients. HGG and SBM display a high degree of similarity on magnetic resonance imaging (MRI) images. Consequently, differential diagnosis using preoperative MRI remains challenging. This study developed deep learning models that used pre-operative T1-weighted contrast-enhanced (T1CE) MRI images to differentiate between HGG and SBM before surgery. By comparing various convolutional neural network models using T1CE image data from The First Medical Center of the Chinese PLA General Hospital and The Second People's Hospital of Yibin (Data collection for this study spanned from January 2016 to December 2023), it was confirmed that the GoogLeNet model exhibited the highest discriminative performance. Additionally, we evaluated the individual impact of the tumoral core and peritumoral edema regions on the network's predictive performance. Finally, we adopted a slice-based voting method to assess the accuracy of the validation dataset and evaluated patient prediction performance on an additional test dataset. The GoogLeNet model, in a five-fold cross-validation using multi-plane T1CE slices (axial, coronal, and sagittal) from 180 patients, achieved an average patient accuracy of 92.78%, a sensitivity of 95.56%, and a specificity of 90.00%. Moreover, on an external test set of 29 patients, the model achieved an accuracy of 89.66%, a sensitivity of 90.91%, and a specificity of 83.33%, with an area under the curve of 0.939 [95% confidence interval (CI): 0.842-1.000]. GoogLeNet performed better than previous methods at differentiating HGG from SBM, even for core and peritumoral edema in both. HGG and SBM could be fast screened using this end-to-end approach, improving workflow for both tumor treatments.