The best way to make sure the military does not intervene is by making them have a vested interest in doing nothing.
1 Preservation of Humanity
One simple and understandable reason for this is that they do not want the infection to spread any further, so the military has blocked off any and all escape from the town.
Essentially, rather than having the military doing nothing, you are making them the antagonists instead.
As soon as the government realized there were zombies in this town, they called up the military, surrounded the town with fences, soldiers, and tanks, and told the officers "Absolutely no one is allowed out of this town. If you think anyone is a zombie or infected, shoot them immediately."
I call this the "Scorched Earth" plan. Rather than taking the risk of letting zombies infect the world, the government is going to burn the place to the ground as soon as possible. To avoid being cruel, they'll give the few uninfected survivors a chance. They have, let's say about 15 days to get out of the city before they bomb it to oblivion.
This plan would be great for your story because it offers two things. First of all, it makes it so the army is not only not a deus ex machina for the main characters, but also a major threat. The soldiers aren't coming to save the people, they are here to make sure the infection does not spread no matter what, so they aren't here to help the civilians, they're here to kill anyone suspected of carrying the infection.
Also, adding the looming threat of the city being bombed adds even higher stakes to the story in general. A thrilling story needs a good running clock. It really increases the tension to know exactly it's too late to go back. If we know there are exactly 15 days (or whatever number you want to add, it's up to you) before the bombs go off, then it tells the readers and the characters that there is no time to waste. Every minute that the characters spend bickering, fighting monsters, or doing anything other than trying to escape, is a moment wasted for them.
I like the idea of the military going this route because it adds a lot of moral greyness to the story. Obviously, they do not want to hurt civilians, but the fate of the world is at stake. It is a trolley problem. Destroy one city to save the world from destruction.
From their perspective, they are the heroes, which makes them great antagonists.
That's my first suggestion.
2 Government Coverup/Conspiracy
This idea would also make the military the antagonists, though for different reasons.
In this scenario, the government does not want to admit its own fault. Admitting there are zombies on the loose would be admitting to their own failure, so they do nothing instead.
This is extremely common with real-world governments. A corrupt politician is never going to admit to a mistake because they want to pretend they are always right. Owning up to one's faults looks bad in front of the voting base, so it is better to pretend the problem does not exist and to cover it up as soon as possible. I could easily imagine this being the case during a zombie apocalypse.
"What, zombies? There are no zombies. It's just some strange new variant of rabies or some sort of mass hysteria. That's what it is," the government would say.
It's not hard to imagine politicians being so corrupt that they would leave people to die painful deaths at the hands of zombies rather than being honest about the problem.
Heck, in most zombie stories the apocalypse is usually a direct result of the government's actions.
For example, they were trying to make a biological weapon to use in a war against another country and it accidentally got loose for one reason or another. You mention that the town was built on an ancient graveyard, so it doesn't seem like this is the government's fault per se, but what if they knew about the existence of this clearly zombie-infested graveyard yet allowed the town to be built there anyway?
They might be more concerned with the graveyard than the safety of the people.
"Hmm, zombies we can use as biological weapons. That's great. We should study this. Oh, there are people living there? That sucks. We'd better way for them to all turn into zombies so we can study them."
It sounds heartless, but this kind of callousness is to be completely expected from real-world governments, who are about as heartless as they come.
3 The Army's Too Overwhelmed or Can't Be Bothered
It's also possible that the army has simply been overrun already. The zombie infection could have spread so fast that they have no way of handling the massive influx of infections. In the worst scenario, the infection spread so rapidly and so many people died that the military is nothing at this point. It's pure anarchy. No one is safe. Whether you were rich or poor in the old world means nothing now because we're all equals in the face of death.
The army is scrambling to fix the problem, and they just do not have the time or resources to help the town where the main characters are at. By the time anyone even remembers that place, the military has already been so depleted that there is nothing it can do at this point.
An even crueler explanation would be that the military and the government do have enough resources to help this place, but they'd just rather protect their rich investors. The poor people can just become zombies.
Is there a billionaire in this town? Okay, sure, the military will whisk him away in an instant. Normal people, though? Nah, they're of little value. Leave them to die.
Imagine having to have to pay to be saved from the zombies. If you can't offer the army a decent sum of money, they won't even bother as you're ripped limb from limb. That'd be an interesting social commentary.
I hope you consider one of these ideas for your story.