Medical image semantic segmentation plays a crucial role in assisting diagnosis by accurately extracting key regions within images, thus improving medical efficiency and accuracy. Medical image segmentation technologies have advanced considerably in recent years. However, challenges such as the difficulty of segmenting complex anatomical structures and the presence of ambiguous boundaries still persist. To address these issues, we propose an effective diffusion-based model for medical image segmentation by integrating the powerful global context modeling capabilities of Mamba with the generative strength of diffusion models. Specifically, an encoder module is constructed using Mamba to mitigate detail loss during the sampling process and to establish global contextual relationships, thereby enhancing the model’s feature extraction capacity. In addition, we design a feature optimization module that strengthens inter-channel information interaction and captures multi-scale features for fusion, leading to improved feature representation. We evaluated our model’s performance using three datasets: ISIC, PH2, and MoNuSeg. Experimental results demonstrate that our model exhibits excellent segmentation performance and accuracy. The code for our model is available at https://github.com/lmkxl/EDiffusion.