The increasing reliance on digital technologies is transforming healthcare services, with the integration of Internet of Medical Things (IoMT) devices enabling real-time patient monitoring and optimized treatment in critical conditions. However, their weak security measures create entry points for cybercriminals, risking large-scale data breaches and exposing sensitive medical and financial information. Beyond privacy concerns, such attacks can disrupt critical healthcare services, delaying life-saving treatments. Early detection and mitigation of anomalous network traffic are essential for ensuring patient safety and system reliability. In this study, we used the “IoMTTrafficData dataset 2023” to evaluate the effectiveness of various Machine Learning (ML) algorithms in detecting cyberattacks within IoMT networks. In addition, we employed an incremental feature selection strategy and investigated the impact of feature dimensionality on model performance. Features were ranked based on Information Gain (IG) scores, and four ML models: Logistic Regression (LR), Decision Tree (DT), Naïve Bayes (NB), and Random Forest (RF) were trained and evaluated using progressively larger sets of the top-ranked features (top 5, top 10, top 15, top 20, and top 25). Our findings reveal that DT and RF consistently outperformed LR and NB, achieving 99% accuracy with just the top 10 IG-selected features. Furthermore, using the top 15 or more features, both models attained a precision, recall, and F1-score of 99%, which demonstrates efficient intrusion detection in IoMT environments with optimized feature sets.