What we did for IHSA Western (so horsemanship) was pull hair pack into a tight, low ponytail and secure. Then we’d make the bun by coiling the ponytail around itself and secure with another hairtie or bobby pins. Then we’d take a thin hairnet (the kind that you DON’T use for hunter hair!) and put that over just the bun, securing with bobby pins sticking straight into the bun. Hairspray everything to high heaven.
Then for the hat we’d spray a little hairspray on the inside/forehead area of the brim to make it a little tacky, and put the hat on. Then bobby pin the hat into your hair. Best bobby pins had a straight edge that goes into the inner hat band, and the kinky end into your hair.
Anyone with bangs got her bangs pulled up and bobby pinned to the top of her head. Since my hair is curly I’d often straighten it the night before to make it easier to handle, or I’d use one hairnet over my head and another over the bun, but that was usually a PITA.