Perhaps overly simplistic of me but the dictionary defines "military" as such:
noun
noun:
military; plural noun:
militaries
- the armed forces of a country.
Now, again, I'm dumb on some things, but Starfleet behaves as the "armed forces" of the Federation. They engage in power projection (Angel One), they engage in defense (Balance of Terror), they strike back when attacked (Best of Both Worlds).
Now, do I think Starfleet is militaristic? No, I don't. I think there is a different attitude than is currently present in modern militaries, and I would expect it. But, Starfleet as the military of the Federation? Again, if it isn't why does it behave in these ways? Why not have a dedicated defensive force to protect the Federation and its interests?
As uncomfortable as it is, we are not left with many solutions to this question, beyond the fact that the Federation is defended by it's chief exploratory agency. It would be very simple if the Federation had a military and they were referenced for completing armed conflicts. Take all of the mystery away.
Instead, we are left with a very contradictory presentation at times.