Put down dropcloth plastic (not a tarp) first. Tarps are not waterproof and actually hold water in their weave.
Lay your pallets out. Keep them at least 6-12" away from a wall. If you worry about hay touching the ground, stack 2 levels of pallets. Be sure the long slats on top face towards you, not crosswise (you can’t slide bales across sideways slats, only along the length of them).
Put your bales down strings up. Water cannot ‘wick up’ if there are no long stalks sticking down to the ground, which there would be if you put them on edge.
The stack will also be more stable and tilt less.
Lay those bales across the slats and across however many pallets you think you need: All the same direction if you can. If you can’t, then lay the bales closest to exterior walls or weather ‘ends out’ so just the ends of the bales, not the sides, might get weathered or go bad = a flake, not the whole side of a bale.
Stack as high as you can reasonably go. If you worry, you can rope around a level like a belt and keep it in place so your stack is less likely to collapse if you climb it.
If the stack is not inside, you should stack with the sides slightly overhanging as you go up to protect the lower bales; and get some straw bales and peak the top, then cover with plastic AND a tarp.
Most barns seem to leak, too. Another loose plastic dropcloth over the hay will protect from this, too. Don’t seal hay tightly or you will get mold and mildew, possibly even heating and fire. Hay needs to breathe and continues to dry even in damp winters.
Its wonderful to have a good stack of hay left in spring because you planned right in the fall.