Here is the situation. The villain used a Sleep spell to take out a player.
each creature affected by this spell falls unconscious until the spell ends, the sleeper takes damage, or someone uses an action to shake or slap the sleeper awake.
Then he used Mold Earth to make a 5 foot pit.
If you target an area of loose earth, you can instantaneously excavate it, move it along the ground, and deposit it up to 5 feet away. This movement doesn’t have enough force to cause damage.
Then he used the Gust spell to move the player into the pit (auto fail of saving throw due to being unconscious.)
You seize the air and compel it to create one of the following effects at a point you can see within range:
One Medium or smaller creature that you choose must succeed on a Strength saving throw or be pushed up to 5 feet away from you.
He then quickened another Mold Earth spell to cover the character up with dirt.
My question is, how long will it take for the character to dig through a 5' cube of dirt? Are there any rules for this?
The amount of time matters because the character only has his Constitution modifier in rounds to live without air. The character is asleep when the dirt covers him, so he doesn't get an action to hold his breath.
Time will end up being a plot device to give other characters a chance to save him.
Best Answer
There are no general rules for digging speed
There are no general rules for how quickly characters can dig, whether they're doing a proper excavation from outside the hole or if they're trying to dig themselves out of a grave.
Other answers have fairly pointed out that the realistic effect of being shoved into a hole and having a five foot cube of dirt dropped on you is that you die; the pressure of a couple of tons of earth will squeeze the life out of anyone pretty quickly. So, in the real world, the unfortunate character is dead and there's not much they can do about it.
However, D&D is a system where sufficiently heroic and healthy adventurers can easily survive falling a thousand feet onto rocks and will then stand up and walk it off, so the realistic ruling doesn't strike me as being particularly genre-appropriate. You probably want the unfortunate character to have a reasonable chance of surviving, especially if you don't want this particular trick to become your players' go-to method for defeating any medium size enemy.
A specific example of digging out a buried character
A quick search on D&D Beyond for any similar situations from the published books reveals the Hidden Shrine of Tamoachan adventure, from Tales From the Yawning Portal, in which there is a scenario which can result in an adventurer being buried by rubble:
So in this case, the adventurer is sufficiently buried that they cannot breathe, and extricating themselves on their own requires an Athletics check and a minute of effort, though it does not specifically clarify how long it would take for another character to dig them out - I'd suggest that would be a minute as well, reduced proportionally if multiple characters work together. You could lift this mechanic directly to use in your own situation.
Personal ruling
If I were adjudicating your situation, then I would rule along these lines:
To me this creates a scenario which the character has a reasonable chance to avoid (so doesn't feel totally unfair if they do end up in the hole), is likely survivable (a couple of cantrips shouldn't be able to arbitrarily kill things) and the mechanic of surviving is dramatic enough to be interesting and rewards teamwork by the players. I would, however, be preparing myself for my players to start trying to use the same trick whenever they have the opportunity to prepare a battlefield before a fight.