I have a wooden sheet of plywood that acts as a protective topper for an outdoor bath tub (don't ask).
I'm looking for a way to add folding legs to the underside that will rest in the bath tub when the topper is on, and fold out to form a table sitting alongside the bathtub while it's in use
Hmm. If I'm visualizing this correctly, and depending on the size of the table . . .
Two pairs of legs with stretchers in between, on pivots that allow them to fold up agains the bottom of the table, slighly offset so that the legs end up alongside each other when folded instead of interfering. If you want them to touch the bottom of the tub, set them up to fold at the "knees" rather than the "thigh", if you see what I mean. The difficult part is figuring out how to secure them in the extended position. If you're okay with putting in a couple of bolts whenever you unfold, you could add a couple of supports that link the stretchers to the underside of the table at an angle (pivot at the other end again). Or you could attach a length of wood to one stretcher with a pivot and notch the other end so that when the table is unfolded, it drops over the other stretcher and forms a tight cross half-lap joint.
All this requires gluing or screwing hinges or bits of wood pierced for dowels or screws to the bottom of the table to form the pivots.