i often buy farm baled hay, tell them you want to see the hay first, it should be slightly green, not too yellow or brown (that would indicate old hay, possibly dried up & straw'y).
give it the sniff test - basically bung your head in it at both ends & the middle (turn it over & do the bottom too if you can) it should smell sort of sweet & grassy, if it smells mouldy then its no good.
also it you do as Swissgreys suggest see if you can pull a bit from the middle of the bale, it should come away without clouds of dust ( this could be either - dust, dirt or even worse mould spores that could cause respiratory problems

look for grey/black patches of mould too - if you see it -definitely dont buy it!
the last bale i got i was climbing all over the bales in the barn & seen a lovely green bale, but when i did the sniff test it had a mouldy/damp smell to it - it had been close to the edge of the barn, so had been exposed to the elements, although it did look good.
tell them you want minimal dust & good quality hay, its usually so much cheaper if you can find a good bale & have room to store it.even if you share half a bale with somebody else its even more economical. x