If you’re in an open powerboat, your best chance would be to apply full throttle and get the hell away from the storm as fast as you can, like the parent commenter did.
If you manage to find yourself in a lightning storm in a small, open sailboat, you’ve made a pretty big mistake, but essentially the same rule applies.
On larger vessels, if you’re belowdeck and aren’t touching anything metal, a lightning strike is usually a survivable incident, especially if your boat has a thoughtfully designed lightning protection system. All this involves is making sure you give the lightning a low-resistance path to ground through your boat’s keel and then the water that doesn’t run through anything expensive.
edit: I realize now maybe you didn’t mean specifically in the “on a boat” situation. Hopefully this comment is maybe interesting to fellow salty sea dogs. Yarr.