Continuous monitoring is critical to improving the quality of life of people with diabetes. Leveraging technologies such as the Internet of Things (IoT), modern communication tools, and artificial intelligence (AI) can contribute to reducing healthcare costs. The integration of various communication systems allows the provision of personalized and remote healthcare services. The increasing volume of healthcare data poses challenges in storage and processing. To overcome this challenge, this paper suggests intelligent medical architectures for intelligent e-health applications. To provide cutting-edge medical services, 5G and 6G technologies are necessary, since they can satisfy critical needs, including high bandwidth and energy efficiency. This work presents an intelligent machine learning (ML) using an ensemble learning-based real-time monitoring system for diabetes patients. Mobiles, detectors, and other intelligent gadgets are used as buildings to gather measurements of the body. Subsequently, the collected data undergoes a normalization procedure for preprocessing. Principal Component Analysis (PCA) is employed to extract features. The ranking of every feature in the dataset is then assessed using two feature selection (FS) techniques, namely information gain (IG) and chi-square (chi2), and the association between the features chosen by the FS methods is then found using Pearson's correlation method, which is one of the correlation methods that can be used to find the correlated between the selected features. For diagnostic purposes, the intelligent system employs data classification through an ensemble learning approach using XGBoost and Random Forest (RF) as base models, which is named (ENS XGRF). The final classification is determined by a hard voting mechanism in conjunction with particle swarm optimization (PASWOP). The simulation results underscore the superiority of the suggested approach in terms of accuracy when compared to alternative techniques.