This study aimed to investigate in situ exopolysaccharides (EPSs) production by Bacillus coagulans IBRC‐M 10807 under different fermentation conditions to improve the technical‐functional properties of whole wheat flour sourdough and obtain high‐quality products. For this purpose, the effectiveness of four efficient factors including B. coagulans (8 Log CFU/g), FOS (0%, 2.5%, and 5% based on flour weight), fermentation temperature (30, 35, and 40°C), and fermentation time (12, 18, and 24 h) was investigated on the production of functional sourdough. Our work focused on optimizing probiotic sourdough by investigating probiotic viability, pH, total titratable acidity, antioxidant properties, and EPS measurement. The first optimal formulation for maximized production of the in situ EPSs by the numerical optimization included FOS 0%, B. coagulans IBRC‐M 10807 8 Log CFU/g, fermentation temperature of 30°C, and fermentation time of 12 h. In this case, EPSs was 59.28 mg/g and probiotic was 10.99 Log CFU/g. The second optimal formula by considering the highest viability of probiotic together with EPS production was determined as FOS 4.71%, B. coagulans IBRC‐M 10807, 8 Log CFU/g, fermentation temperature of 30°C, and fermentation time of 20 h. The predicted amount of the EPSs and probiotic viability via the second formulation were 54.4 mg/g and 11.18 Log CFU/g, respectively. Analyses of optimal sourdough using FTIR, SEM, and DSC revealed that FOS and probiotics significantly reduced the enthalpy of amylopectin retrogradation and delayed it compared to other samples. Therefore, improving the final product's technological capabilities and shelf life can be credited with potential benefits.