Bacterial meningitis (BM) requires prompt treatment, especially for neonates, the elderly, and immunocompromised individuals. Understanding the immune response is essential, as it precedes clinical symptoms. However, systematic studies have been lacking. This study identifies immune-related genes that could enhance BM diagnosis and treatment. Mendelian randomization, differential gene expression, and co-expression network analyses revealed key genes linked to BM. RNF144B was identified as a risk gene, correlating with increased neutrophil levels during the initial phase of meningitis, whereas FYN was identified as a protective gene, correlating with increased NKT cells during remission and recovery. Single-cell RNA sequencing and gene set enrichment analyses showed RNF144B expression in monocytes and neutrophils, while FYN was associated with NKT cells. During BM onset, there was an increase in neutrophil proportions and a decrease in NKT cell proportions, indicating a negative correlation. In recovery, RNF144B expression and neutrophil levels decreased, while FYN expression and NKT cell levels rose, underscoring the protective role of NKT cells. FYN may regulate T-cell receptor function in NKT cells, reducing BM risk. This study suggests that the expression patterns of these two genes exhibit significant differences at various stages of the disease, thus offering potential biomarkers for aiding in more accurate diagnoses of BM and monitoring disease progression.