Although the etiology of multiple sclerosis (MS) is still unknown, it is commonly accepted that environmental factors could contribute to the disease. The objective of this study was to analyze the humoral response to Epstein-Barr virus, human herpesvirus 6A/B and cytomegalovirus, and the levels of 25-hydroxyvitamin D (25(OH)D) and the three main short-chain fatty acids (SCFA), propionate (PA), butyrate (BA) and acetate (AA), in MS patients and healthy controls (HC) to understand how they could contribute to the pathogenesis of the disease. With this purpose, we analyzed the correlations among them and with different clinical variables and a wide panel of cell subsets. We found statistically significant differences for most of the environmental factors analyzed when we compared MS patients and HC, supporting their possible involvement in the disease. The strongest correlations with the clinical variables and the cell subsets analyzed were found for 25(OH)D and SCFAs levels. A correlation was also found between 25(OH)D and PA/AA ratio, and the interaction between these factors negatively correlated with interleukin 17 (IL-17)-producing CD4+ and CD8+ T cells in untreated MS patients. Therapies that simultaneously increase vitamin D levels and modify the proportion of SCFA could be evaluated in the future