This paper introduces an Agent-Based Model (ABM) designed to investigate the dynamics of the Internet of Things (IoT) ecosystem, focusing on dynamic coalition formation among IoT Service Providers (SPs). Drawing on insights from our previous research in 5G network modeling, the ABM captures intricate interactions among devices, Mobile Network Operators (MNOs), SPs, and customers, offering a comprehensive framework for analyzing the IoT ecosystem's complexities. In particular, to address the emerging challenge of dynamic coalition formation among SPs, we propose a distributed Multi-Agent Dynamic Coalition Formation (MA-DCF) algorithm aimed at enhancing service provision and fostering collaboration. This algorithm optimizes SP coalitions, dynamically adjusting to changing demands over time. Through extensive experimentation, we evaluate the algorithm's performance, demonstrating its superiority in terms of both payoff and stability compared to three classical coalition formation algorithms: static coalition, non-overlapping coalition, and random coalition. This study significantly contributes to a deeper understanding of the IoT ecosystem's dynamics and highlights the potential benefits of dynamic coalition formation among SPs, providing valuable insights and opening future avenues for exploration.