So I think we're operating on different interpretations of the term 'militaristic'.
Star Trek primarily depicts the Federations (of planets) Military on the frontier of their space.
The society within the Federation is generally a democratic one and the use of Star Fleet is not to invade.
"Starfleet's function was to explore unknown territory on the behalf of the Federation government, to defend the Federation and its allies from threats, to further Federation policies and interests throughout interstellar space, and, when applicable, to initiate first contact with newly-discovered worlds and to engage in diplomatic negotiations on the behalf of the Federation. "
https://memory-beta.fandom.com/wiki/Federation_Starfleet
"Unlike its traditional rivals who derive power from a single dominant species subjugating other races within the boundaries of their empire, the Federation's various Member States join willingly and are equals in the Federation's democratic society."
https://memory-beta.fandom.com/wiki/United_Federation_of_Pla...
contrast that with:
"Militarism is the belief or the desire of a government or a people that a state should maintain a strong military capability and to use it aggressively to expand national interests and/or values. It may also imply the glorification of the military and of the ideals of a professional military class and the "predominance of the armed forces in the administration or policy of the state (see also: stratocracy and military junta).... Militarism has been a significant element of the imperialist or expansionist ideologies of many nations throughout history. "
https://en.wikipedia.org/wiki/Militarism
"A stratocracy is a form of government headed by military chiefs."
https://en.wikipedia.org/wiki/Stratocracy
"A military junta is a government led by a committee of military leaders. The term junta means "meeting" or "committee" and originated in the national and local junta organized by the Spanish resistance to Napoleon's invasion of Spain in 1808."
https://en.wikipedia.org/wiki/Military_junta