I recently bought a new bicycle, and my old headlight mount didn't fit around the fatter handlebar in a way that I was happy with. So quickly modeled this one in Fusion 360. It's printed in PLA to help keep the dimensions accurate, but it can be easily printed in any high-strength plastic. Check out the post-processing details for the hardware I added to make the mount secure.
The top mount will be much stronger if you print it in the default orientation, though you will likely need supports across the bar clamp. The bottom mount can be printed on its side with no supports.
I added some additional hardware to make the mount stronger. The holes in the bottom mount have 3mm heat-set threaded inserts installed into them. Then I clamp the unit together using m3x16 button head screws. A tiny shim of rubber around the handle bar can help out of you find that the mount is spinning on the handlebar.