I can't put my hands on my copy of the ABYC standards at the moment, so I can't give you the "legal." I've certainly seen plenty of
boats, including
commercial, with batteries out of boxes.
Think it through. Black plastic
battery boxes don't restrain batteries; you need to do that with straps or fiberglas/wood compartments. If straps, you need to make sure that spilled acid won't corrode them. Box lids preveent dropped wrenches from becoming fireworks displays. Shifting batteries are a common fire source, and the temperature generated is plenty to ignite fiberglas resin, which burns like oiled paper.
So will your design prevent all this? I used open boxes, with bicarbonate of soda in the bottom of each to neutralize any loose acid (flooded batteries) and a screw-in-place restraining board over the top to keep the bank in place. It's topped with a
plywood cabin sole, so being bounced won't cause a fire. Not having lids made it easier to join a bank of six batteries. Come up with a design that will hold those suckers firmly in place and insulated during a knock down, and move on the the next problem.
Good luck with it.