Yes, 1 gram of hydrogen molecules contains as many atoms as 1 gram of hydrogen atoms.
Work Step by Step
Whether there is 1 gram of H molecules or 1 gram of H atoms, hydrogen is the only element present in both cases. Because hydrogen has a set molar mass, as do all elements, 1 gram of hydrogen will always be 1 gram of hydrogen. If you compare 1 gram of H atoms and 1 gram of H$_2$ molecules, there will be half as many H$_2$ molecules, since there are two H atoms per molecule. However, the number of atoms is the same.