So I got directed to this thread by
@fireproof78 and while it's a bit dead I'm going to revive it a bit just to hurl my two cents in.
And shockingly its not going to be a repeat as I've not seen this point in this thread.
The closest real world version of Starfleet we have at the minute on Earth is....
The Japanese Self Defence Forces.
Has military ranks? Check. Officially all SDF personnel are civil servents in the eyes of the Japanese Law, but hold military ranks to be able to integrate with US/NATO forces when needs be.
Sleight of hands definition of its craft? Check. Defiant's a warship, lets not kid ourselves. Officially it's an "escort vessel". In the same way the Japanese have a "Through Deck Destroyer" which they're currently reinforcing the deck plating to carry F-35s for. I'm sure its because they take off vertically they'll call them "Rapid Horizontal Flight Helicopters" or something.
Conducts Scientific research? Check. This is perhaps a bit of a 60s holdover before, in our world, the military industrial complex took over production, where a lot of scientific research was legitimately done by the military in dangerous situations. Same with deep sea diving too. Which covers a good bit of the exploration too. Even today, "military diver" tends to be held in a fairly high regard.
Tends not to shoot first? Check. We see time and time again Star Fleet vessels to not shoot first or otherwise engage in unecessary gunfights. While each Starfleet vessel is technically a walking advertisement for gunboat diplomacy, it's a heavy emphasis on
Diplomacy. Japanese ground forces must ask for permission and has to confirm they are definitely under fire before responding.
So no, Starlfeet isn't military. It's a Self Defence Force. This rather neatly covers most of the points raised in this thread and allows for what is basically a bunch of heavily armed civil servants to go about the galaxy doing whatever they want.