Internet of Medical Things (IoMT) is a recently introduced paradigm which has gained relevance as an emerging technology for widely connected and heterogeneous networks. In the medical context, these networks involve many different processes run by different types of devices called objects that interact and collaborate to achieve a common goal (e.g, diagnosis, treatment, monitoring, or rehabilitation of a patient). An IoMT framework in a smart healthcare system dynamically monitors patients to respond to their assistance demands so that vital signs of critical or unusual cases can be uncovered based on the collected data. To this end, an effective technique called SIoMT (Swarm Intelligence optimization technique for the IoMT) is proposed in this paper for periodically discovering, clustering, analyzing, and managing useful data about potential patients. Notably, the SIoMT technique is widely used with distributed nodes for analyzing and managing data groups. Different from the existing clustering algorithms, SIoMT performs clustering based on the characteristics and distance between objects or swarms. More specifically, these data are collected and grouped, in early stage, using a clustering approach inspired by the Bee Colony Optimization algorithm (BCO), adopting some standard quality measures which helped minimizing the latency and required computational cost. To test the performance of the proposed SIoMT, one public dataset (Ward2ICU) was considered from the online source. Various experiments were done to analyze the effects of different parameters on the proposed SIoMT's performance, and the results from the final variant of the proposed algorithm were compared against different variants of the same algorithm with different clustering algorithms and different optimization algorithms. Subsequently, after analyzing different components by solving various IoMT datasets, the capability and the superiority of the proposed SIoMT approach is well-established among its competitive counterparts.