Catalyzes the condensation of para-aminobenzoate (pABA) with 6-hydroxymethyl-7,8-dihydropterin diphosphate (DHPt-PP) to form 7,8-dihydropteroate (H2Pte), the immediate precursor of folate derivatives. Is involved in the bioactivation of the antituberculous drug para-aminosalicylic acid (PAS). PAS is a close structural analog of pABA and acts as an alternative substrate for DHPS, leading to hydroxy-dihydropteroate (H2PtePAS). Metabolomic studies show that PAS, despite its in vitro activity as a competitive inhibitor of DHPS, does not inhibit growth of M.tuberculosis by inhibiting DHPS. PAS exerts its antimycobacterial activity through its effects on M.tuberculosis folate metabolism downstream of DHPS. PAS poisons folate-dependent pathways not only by serving as a replacement substrate for DHPS but also by the products of that reaction serving as replacement substrates and/or inhibitors of subsequent enzymes. (7,8-dihydropterin-6-yl)methyl diphosphate + 4-aminobenzoate = 7,8-dihydropteroate + diphosphate (7,8-dihydropterin-6-yl)methyl diphosphate + 4-aminosalicylate = 2-hydroxy-7,8-dihydropteroate + diphosphate Magnesium is required for activity, even if it seems to interact primarily with the substrate. Is potently inhibited by the sulfone dapsone and the two sulfonamides sulfamethoxazole and sulfamethoxypyridazine, with Kis in the range of 12 to 32 nM. Is only poorly inhibited by p-aminosalicylate (PAS) (PubMed:10542185). The inhibition of DHPS by sulfathiazole antagonizes PAS-mediated growth inhibition and therefore confers resistance to PAS (PubMed:23779105). kcat is 35 min(-1) (PubMed:10542185). kcat is 28 min(-1) with pABA as substrate, and 45 min(-1) with PAS as substrate (PubMed:23118010). Optimum pH is 8. Cofactor biosynthesis; tetrahydrofolate biosynthesis; 7,8-dihydrofolate from 2-amino-4-hydroxy-6-hydroxymethyl-7,8-dihydropteridine diphosphate and 4-aminobenzoate: step 1/2. Homodimer. Belongs to the DHPS family.