In general, I don't think the distinction is between fantasy and science-fiction, but actually between aristocratic and democratic narratives (and this is one of the reason I prefer Star Trek over Star Wars: Starfleet officers might seem like naive do-gooders, but it's better than patronizing and self-important Jedi knights...)
Roddenberry's atheism crept into the Trek narrative - SF people time and again dismiss mysticism/religion/or even magic as naive or outright stupid.
In the TNG episode The Devil's Due
Ardra is debunked from being a god with magical powers to nothing more than a con artist. In Who's Watching the Watchers
religious belief systems are outright called backward and stupid.
And of course on DS9 the Profits are referred to as 'worm hole aliens,' by the SF folks.
Wars as you say has far more elements of fantasy than Trek does as the force like with the wizards in Harry Potter inherit their special powers.