Modern engineering and machinery enables us to build some pretty impressive things. Emphasis on modern.
However, the city of Erebor, as shows in the LOTR movies is ... gargantuan. Vast ceiling supported by ridiculously tall columns, massive staircases over lava lakes, halls that would put large airport terminals to shame, etc. Even with our technology that would be an undertaking that would take decades (I almost want to say centuries).
When digging within a mountain (not necessarily under sea level, which brings problems of its own) you have to consider that any sort of earthquake, etc. would potentially cause massive collapses if you were to try and build these massive halls. You would need to reinforce them to a ridiculous degree.
I sincerely doubt that 5000 workers with medieval tech could pull off something even a third of the size within their life times.
Some sort of mountain fortress? Sure. Maybe even a pretty cool one.
But Erebor? No.
Also keep in mind that in most LOTR lore these dwarven cities are depicted as having been built over generations and generations. And dwarfs live for hundreds of years. If you were to combine a long timeline with some sort of dwarven magic you might be able to explain it.