Enterocytozoon hepatopenaei (EHP), causing hepatopancreatic microsporidiosis (HPM), significantly impacts Litopenaeus vannamei, leading to economic losses. Using bioinformatics and machine learning, this study characterized EHP infection stages and host-pathogen interactions. Consensus clustering of 2,613 metabolism-related genes from 36 shrimp samples identified four subclasses: healthy (HG), heavily (HEG), moderately (MEG), and lightly infected groups (LEG). Gene Set Variation Analysis (GSVA) revealed subclass-specific metabolic and immune patterns, with HEG showing impaired carbohydrate metabolism and upregulated amino acid degradation, MEG indicating recovery, and LEG demonstrating metabolic normalization. Weighted Gene Co-expression Network Analysis (WGCNA) linked infection subclasses to pathways like Hippo, JAK-STAT, steroid biosynthesis, and calcium signaling. Machine learning identified 52 characteristic genes involved in EHP proliferation (e.g., RAPTOR), host invasion (e.g., cell surface glycoprotein 1), and host defense (e.g., mucin-5AC). A stacked classifier model predicted infection severity with high accuracy. EHP severely impacts immunity, autophagy, and oxidative stress in early infection, with host responses evolving from detoxification to metabolic recovery and adaptation. Key pathways and genes, including polar tube protein (PTP) and mucin-5AC, were identified as critical to host-pathogen interactions, offering insights into EHP infection dynamics and potential intervention strategies.