Catalysis of the reaction: 4-(beta-D-ribofuranosyl)aminobenzene 5'-phosphate + (2-amino-4-hydroxy-7,8-dihydropteridin-6-yl)methyl diphosphate = N--4-(beta-D-ribofuranosyl)aniline 5'-phosphate + diphosphoric acid.
7,8-dihydropterin-6-yl-methyl-4-(beta-D-ribofuranosyl)aminobenzene 5'-phosphate synthase