This is unlikely enough that if you want to go down this path, you should just handwave it and forget about it.
The first thing to note is that if you dropped a bomb like that, it won't just bury itself. It will decelerate rapidly, breaking things. You will not have a functioning bomb after it hits the ground -- you will have a pile of radioactive junk.
But let's say the bomb wasn't dropped. Let's say we hiked it in on a humvee, and burried it by hand.
Now you have to deal with the issue that there is an enormous amount of interest from nuclear powers to not have their bombs go off if they fall into enemy hands. This means they are unlikely to go off without an intelligent adversary actively trying to make it happen.
Setting off a nuclear bomb is actually not easy. To do this, we invented the "exploding bridgewire" initiator, capable of detonating several charges all over the bomb with a tolerance of about 100ns. These are not easy to set off intentionally. Having them go off by accident is highly unlikely.
So basically, we're going to have to assume the following scenario: The US military hands all of our nuclear weapon secrets to an unstable mad scientist, who intentionally creates a bomb designed to sew confusion. He designs a bomb with a timer that is designed to go off as late as possible.
Then he buries it.
Now the limit is going to be the shelf life of the material. The nuclear fuel isn't going anywhere. U-235 has a half life of 70 million years. Plutonium's half life is lower, ranging down to as low as 14 years if you use P-241, so there's no reason he'd choose this.
Atomic bombs are dependent on conventional explosives to set them off. If you use RDX, it's shelf life is about 5 years. That would be a major limiting factor. Fat boy used RDX and a few other carefully balanced explosives to achieve its goals. As they decay, this balance would be thrown out of whack.
To simplify things, you could design your bomb after Little Boy, rather than Fat Man. Little Boy's design was much simpler. Little boy only needed a "gun" to fire a ring of material down the body of the weapon. This gun was powered by cordite, and we've got documentation suggesting cordite can stay "good" for 100 years or longer. Also, because it's not a complicated timing-critical process, you'll have more slop room for it to continue functioning as the cordite decays.
Beyond this, your main limit will be the lifespan of the battery. If you use a thermal battery, you may be able to get this into the decades.