Too close if he can touch the tube , and needs to mounted nearer the centerline of the tank and directed DOWN not OUT.
If a good brand (ie Arcadia, Zoo Med or Exo Terra) you will not have eye issues even under 4 inches from a 12%UVB T8 or T5HO as in the wild in their natural range bearded dragons are exposed to much higher levels of UV than are produced by UV globes designed specially for reptiles see :
viewtopic.php?f=6&t=234801&p=1806497#p1806497 (curve for Alice Springs in particular, peaks just under 500 microW UVB / sq.cm in their natural range).
Even at 4 inches away the UVB is not going to exceed 500 microW UVB / sq.cm for a 10%UVB t5ho tube with a reflector hood behind it. Remove the reflector and this is dropped by half.
A t8 10%UVB tube with a reflector will produce about 200-220 microW UVB / sq.cm at 4 inches.
See
viewtopic.php?f=34&t=235611
Cable ties poked through the mesh will hold the hood in position no problem.