I see there have already been some good answers, but I have another candidate to offer.
Back in the 1930s, there was a pulp magazine series called Operator #5 (soon switched to Secret Service Operator #5). The series hero was a brave young secret agent (working for the USA), Jimmy Christopher, who was a master of disguise and had some fictitious high-tech gadgets which he habitually carried on his person for sudden emergencies. In those days, the typical "pulp novel" was a self-contained story, with the hero having decisively defeated the bad guy (or a whole collection of bad guys) by the end of that same tale -- the obligatory happy ending, you know.
But Operator #5 went through a lengthy ongoing storyline that is sometimes called "the War and Peace of the pulps." Written by Emile C. Tepperman (though he was working under the magazine's house name of "Curtis Steele," as did anyone else who wrote stories about Operator #5). This saga filled up 13 consecutive issues of the magazine, with about 750,000 words of prose when all was said and done, and the whole thing is now sometimes called "The Purple Invasion."
It began with Operator #5 #26 (June 1936), with the long main story titled: "Death's Ragged Army." (There were some unrelated shorter stories toward the back of the issue.) This was the beginning of a saga of an imaginary war which was only resolved in #38 (March 1938), titled: "The Siege That Brought the Black Death."
I own an e-book version of that first installment. It starts with a scary premise: As the opening chapter sets the stage for us, it becomes apparent that the legions of "the Central Empire" have already invaded and easily overrun the northeastern corner of the USA. (The New England states and the state of New York, and maybe a few other bits and pieces in that region.) And they show no signs of stopping there. These legions of soldiers are led by senior officers who often have Germanic-sounding names -- examples include "Colonel Mainz" and "Baron Oscar zu Lambrecht."
The Central Empire has advanced weapons which Operator #5 recognizes are far more powerful than anything the United States military possesses. This includes a mysterious "Green Gas" which, we are assured, could be used to sterilize the entire USA in a matter of weeks if the ruler of the Central Empire ("Emperor Maximilian") were so bloodthirsty as to feel the need to do so. Fortunately, he prefers to conquer as much of the American population as possible so that they can keep working hard and contributing to his empire's economy. Later in the series, the Central Empire will use germ warfare as well. (And they very nearly overrun the entire USA before the tide finally turns in favor of Operator #5 and his fellow Americans as they fight their way to victory.)
By the end of the first installment, Maximilian has died, but this is not good news for the Americans. The old Emperor's son, Rudolph, has inherited control of the Central Empire, and he is known to be much more cruel and bloodthirsty than his daddy ever was. (Any resemblance between the names "Adolf" and "Rudolph" is, of course, not coincidental.)
So if you count "alternate history of a scary possible future" and "the enemy uses advanced weapons that didn't exist at the time the story was written" as being strong symptoms of science fiction, then this qualifies as a very early science-fictional treatment of a militaristic group who were never called "Nazis" or "Germans" in the texts of the stories, but who were obviously based on what Adolf Hitler was doing in Central Europe to make Germany become once again a military force to be reckoned with. (And Hitler wasn't exactly shy about sharing his desire to grab more and more real estate to his collection, either, although these stories started being written before he'd managed to annex Austria, for instance, and before he actually declared war on anyone.)