Both genetic and environmental factors contribute to multiple sclerosis (MS) risk. Infection with the Epstein–Barr virus (EBV) is the strongest environmental risk factor, and HLA-DR15 is the strongest genetic risk factor for MS. We employed computational methods and in vitro assays for CD4 T cell activation to investigate the DR15-restricted response to EBV. Using a machine learning-based HLA ligand predictor, the EBV glycoprotein B (gB) was predicted to be enriched in epitopes restricted to presentation by DRB1*15:01. In DR15-positive individuals, two epitopes comprised the major CD4 T cell response to gB. Surprisingly, the expression of recombinant gB in a DR15-homozygous B cell line or primary autologous B cells elicited a CD4 T cell response, indicating that intracellular gB was loaded onto HLA class II molecules. By deleting the signal sequence of gB, we determined that this pathway for direct activation of CD4 T cells was dependent on trafficking to the endoplasmic reticulum (ER) within the B cell. We screened seven recombinant EBV antigens from the ER compartment for immune responses in DR15-negative vs. DR15-homozygous individuals. In addition to gB, gH was a key CD4 T cell target in individuals homozygous for DR15. Compared to non-DR15 controls, DR15-homozygotes had significantly higher T cell responses to both gB and gH but not to EBV latent or lytic antigens overall. Responses to gB and gH were slightly elevated in DR15 homozygotes with MS. Our results link MS environmental and genetic risk factors by demonstrating that HLA-DR15 dictates CD4 T cell immunity to EBV antigens.