Draw the structures.
1: 2-nitrophenol is internally hydrogen-bonded. H of OH group to one of the O's of the NO2 group. This means it will not tend to H-bond to adjacent molecules, and will behave as less polar.
2: In 4-nitrophenol the NO2 and OH groups, which create the polarity, are further apart. The further apart the charges in a polar compound, the greater is its polarity. And any hydrogen-bonds must be between molecules, not within them as in 2-nitrophenol.