Don't bury an extension cord.
No. Not safe, not legal, not worth it.
Extension cords are designed for temporary above-ground use. Burying them—even shallow, even for “just a weekend”—invites moisture, ground pressure, and eventual insulation failure. That’s a shock or fire risk waiting to happen. The National Electrical Code exists for reasons that include people who thought “temporary” meant “fine.”
If you need power outside for more than a few hours, use a cord rated for outdoor use and keep it on the surface. If you need buried power, run actual UF-B (underground feeder) cable in conduit, or splurge on the direct-bury stuff. It’s more work, but it’s the difference between “that’ll work” and “that’ll work until it doesn’t.”
This is not where you save twenty bucks.