The army rejected the recruit from the canton of Ticino after he admitted in an interview to having sympathies for the far right and even supported in part fascist ideology, the ATS news agency reported on Thursday.
The candidate for military service also sported a tattoo of an extreme right-wing symbol.
And the army in its background checks discovered far right-wing links on his Facebook page, ATS said.
Based on this information, the army considered him a risk, particularly when it came to handling service firearms.
It refused to authorize equipping him with a firearm and invoked this reason for declaring him unfit for military service, according to the report.
However, the federal administrative court ruled that the army could not draw the conclusion that a recruit posed a risk because of his ideological views.
The court said in a landmark ruling that the army could not conclude that the man would use a military weapon in a bad way just because of these views.
The judges concluded the man did not represent a security risk.
Military service is compulsory for all Swiss men found suitable for service, who are conscripted from the age of 19.
The militia makes up about 95 percent of the Swiss armed forces.