BackgroundThe ketogenic diet has been widely used in the treatment of various nervous system and metabolic-related diseases. Our previous research found that a ketogenic diet exerts a protective effect and promotes functional recovery after spinal cord injury. However, the mechanism of treatment is still unclear. In this study, different dietary feeding methods were used to detect myelin expression and gene level changes between different groups.ResultFirst, KEGG pathway enrichment of upregulated differentially expressed genes (DEGs) in the SCI_KD and SCI_SD groups and GSEA analysis of the two groups found that a ketogenic diet significantly improved the steroid anabolic pathway in rats with spinal cord injury. Through cluster analysis, PPI analysis and visualization of iPath metabolic pathways, Sqle, Sc5d, Cyp51, Dhcr24, Msmo1, Hsd17b7, and Fdft1 changed significantly in the pathway. Second, through WGCNA analysis, all samples are placed in a gene network to analyse the correlation between gene modules and phenotypes. After module analysis, GO function and KEGG analysis showed that rats fed a ketogenic diet showed significantly reduced immune-related pathways, including those associated with immune and infectious diseases.ConclusionA ketogenic diet may improve the immune microenvironment and myelin growth in rats with spinal cord injury through reprogramming of steroid metabolism.