The only solution, is to install a code compliant grounding conductor, circuit breaker, and receptacle.
The circuit breaker is easy. Since you're going from 30 amperes down to 20, you can simply swap the 20 ampere breaker in. However, since you're changing it to a 20 ampere branch circuit, AFCI and/or GFCI protection may be required.
The receptacle is also easy. Just swap out the old receptacle for the new one.
Installing a code compliant grounding conductor may require pulling a new cable. Depending on the home, you might be able to find another way. Though without being on site, it's difficult to suggest a solution.
Once you have the proper circuit protection, wiring, and receptacle. Then you can buy an extension cord, and safely extend the reach of the cord.
If you end up having to pull new cable anyway, you might consider simply installing a new receptacle closer to the tanning bed.
You can do it, it's not cost effective compared with buying extension cords with multiple outlets on the far end, or 2 extension cords, or a 3-1 adapter or several other options. You need:
- Extension cord (14ga at least; 12ga if using 20A receptacles) $10-30
- listed steel strain relief for your cord and 1/2" knockout - $3
- 4" 2-gang all steel box $2
- 2-gang 2 or 4 outlet steel box cover $2
- 1 or 2 duplex receptacles, $1-4
- 1 foot black, white, green solid core 12ga wire, $1
- 3 wire nuts, red $1
Put 6" pigtails on each of the receptacles using side screws or clamp-and-screw (found on better receptacles). Lop the extension cord and push the strain relief down it, gasket side out. Knock out a 1/2" hole on the 2-gang box and bolt the strain relief through it, gasket out. Wire-nut the 3 black wires together, ditto white and green/bare, careful as you are mixing solid and stranded. Cram everything into the box and button it up. Test carefully, done.
You need at least 14ga wire if you have 15A outlets and 12ga wire if any 20A outlets. Doing this with 16ga is unsafe.
A GFCI outlet is a good idea, you can slave the second duplex outlet off the "load" side. If you don't use a GFCI, you must attach the cable ground to the outlet, that will attach it to the metal box, but test this just the same.
Best Answer
I suppose it's safe as long as you wire it properly, including a secure attachment between the box and the cord to prevent the cord from pulling out. It certainly is not code-compliant, but temporary wiring like an extension cord isn't covered by electrical codes I believe. Yes, I would ground the box. (Depending on which outlet you install, it may be grounded automatically with the receptacle mounting screw, but I would do it with a pigtail anyway.
But why wouldn't you just use a power strip instead? Definitely easier and safer, probably similar in price to buying the parts individually.