Functions in two distinct reactions of the de novo folate biosynthetic pathway. Catalyzes the addition of a glutamate residue to dihydropteroate (7,8-dihydropteroate or H2Pte) to form dihydrofolate (7,8-dihydrofolate monoglutamate or H2Pte-Glu). Also catalyzes successive additions of L-glutamate to tetrahydrofolate or 10-formyltetrahydrofolate or 5,10-methylenetetrahydrofolate, leading to folylpolyglutamate derivatives. 7,8-dihydropteroate + ATP + L-glutamate = 7,8-dihydrofolate + ADP + H(+) + phosphate (6S)-5,6,7,8-tetrahydrofolyl-(gamma-L-Glu)(n) + ATP + L-glutamate = (6S)-5,6,7,8-tetrahydrofolyl-(gamma-L-Glu)(n+1) + ADP + H(+) + phosphate 10-formyltetrahydrofolyl-(gamma-L-Glu)(n) + ATP + L-glutamate = 10-formyltetrahydrofolyl-(gamma-L-Glu)(n+1) + ADP + H(+) + phosphate (6R)-5,10-methylenetetrahydrofolyl-(gamma-L-Glu)(n) + ATP + L-glutamate = (6R)-5,10-methylenetetrahydrofolyl-(gamma-L-Glu)(n+1) + ADP + H(+) + phosphate Binds 2 Mg(2+) ions per subunit. kcat is 25 min(-1) with 7,8-dihydropteroate as substrate (at 30 degrees Celsius). Cofactor biosynthesis; tetrahydrofolate biosynthesis; 7,8-dihydrofolate from 2-amino-4-hydroxy-6-hydroxymethyl-7,8-dihydropteridine diphosphate and 4-aminobenzoate: step 2/2. Cofactor biosynthesis; tetrahydrofolylpolyglutamate biosynthesis. Monomer. The N-terminal domain alone (residues 1-287) is sufficient to bind both tetrahydrofolate and dihydropteroate with the same affinity as the intact enzyme, but is not able to bind ATP and has no enzymatic activity. Mutant studies have shown that dihydrofolate synthase and folylpolyglutamate synthetase activities are catalyzed by a single catalytic site. Belongs to the folylpolyglutamate synthase family.