The answer to this depends entirely on the Dragon, and where we’re getting the Dragon.
Game of Thrones Dragon? No, the dragon is fucked.
Shadowrun Greater Dragon? The military is fucked.
The thing is, to answer this question you really need to define the Dragon, because Dragons run from elephant sized fire breathing winged lizard to continent sized fire lizard that can traverse the void of space and set fire to entire planets.
So, let’s start with the Game of Thrones Dragons, arguably on the weaker end of the spectrum.
Game of Thrones dragons are not intelligent, aren’t super big, and have no magical abilities to speak of. I’d say that they’d be easy prey for the modern military.
Let’s go with Smaug from The Hobbit: pretty much the same situation as the Game of Thrones Dragons, Smaug is a giant fire breathing lizard, bigger, and with human level intelligence…but still, no magic. So Smaug would, in my opinion, get trashed by the modern military.
So far it’s not looking good for dragons, but these dragons from more main stream fiction are, quite frankly, weaklings as far as Dragons go in fiction.
Let’s try for a Dragon that’s of a size with Smaug, but with Magic. For this, we’re going to start with Dungeons and Dragons, and we’re going to pick a Red Dragon, of the Great Wyrm category (physical size on par with Smaug).
Our Red Dragon already has a couple of advantages over Smaug: it has a hide reinforced by magic, and it has a genius level intellect coupled with over a 1000 years of accumulated knowledge and wisdom…but nothing insurmountable.
Where the DnD dragon really shines is in its’ spellcasting ability.
Things like invisibility, teleportation, the manipulation of gravity, weather, and time; beams that disintegrate things, mind control, the weaving of powerful illusions, shape shifting, and precognition…all of these things, and more, lie at the dragon’s claw tips, and a clever dragon (which our Red Dragon is) is going to be able to leverage all of this stuff to a very useful degree.
DnD Red Dragon vs Modern Military: Red Dragon wins, the military is only going to have a chance if they surprise the Dragon, or if the Dragon gets super overconfident.
Dragons on the order of Smaug from The Hobbit just aren’t going to be effective against modern armies. They are huge and scary, but they fall like a ton of bricks when faced with weaponry capable of killing them. A well-placed black arrow killed Smaug…how is he going to fare against machine gun fire or missiles? His hide might be thick enough to stop your regular bullets from the average infantryman (I’m not 100% convinced of that though), but one shot from a tank or something on that level is going to explode the dragon into a million tiny pieces.
I think that if we consider the dragon’s physical capabilities only, then it’s going to lose. Dragons just simply aren’t fast enough, tough enough, and their fire breath has far too short a range to be effective in modern warfare. Their size is their chief advantage in medieval-ish fantasy settings, but against modern weaponry that just makes them easier to hit.
Of course, as others have noted, dragons vary quite a lot in their capabilities. So some of them are going to have other abilities. These abilities might be effectively leveraged to good effect.
For example, most dragons of the D&D variety had the ability to polymorph themselves, that is to change their shape. This could be very useful for stealth warfare. It’s easy enough to shoot down a dragon, but what if that dragon looks just like another person or a bird or any number of other creatures? Suddenly that dragon has the capacity to evade just about any army. Of course, there are usually ways to detect such magic, and in some cases dragons do have to revert to the natural form after a certain time. Also, if this is the dragon’s chief ability, then why not use some other mythical beast that does it even better (say, a doppleganger).
The best non-traditional advantage I can think of for dragons? Their wealth.
Smaug had a trove of gold the likes of which should have devalued all coinage in Middle Earth. Some estimates put Smaug as having more gold than all the gold on real life earth. Estimates of its worth are anywhere from $50B to over $1T. A dragon like Smaug could weaponize his assets, perhaps hiding out in his cave and using surrogates to cash in on his gold a little at a time. Before long, he’d probably be the richest person in the world, and probably by a wide margin. Suddenly military action doesn’t seem to be a very effective tactic for dealing with him, since his trillion dollars of assets means that he’s got his tendrils in a large variety of companies and the military doesn’t want to cause a crash.
As a bonus, Smaug’s incredibly long life would make it easy for him to let his investments appreciate considerably. He can also deploy assets in other ways, such as donating to political candidates that support a pro-dragon agenda, or funding pro-dragon groups that want to normalize relations with dragons. The effect of these efforts is again multiplied by his extremely long-life, because he doesn’t need immediate success, just a little bit at time.
Even better? Use your money to start a dragon-based religion. God may not be visible, but dragons are!
In the end, Smaug becomes a normal part of modern life for generations, the most revered and wealthiest being on the planet. After a few generations, he is no longer a frightening presence, just a regular aspect of everyday life. He might even run for office himself someday, making short work of the political opposition. In any event, his fabulous wealth makes him an incredibly influential individual.
In the end, Smaug overcomes the human military advantage by joining society. It could work.