I heard people who loved dragons and swords were shoved into lockers in the 80s and 90s. Was this true? Were the only people who were willing to get into stuff like DnD, fantasy, and sci fi people who spent most of their time in basements?
Why was 1980s, 1990s, and early 2000s American society focused on accumulating wealth and worshiping athletes?
Were there any people in those type periods who enjoyed geek stuff but were athletic and intelligent who ended up becoming military officers?
No, it wasn't true. Most of your post supposes a society that didn't exist.
"Nerds" are not people that play DnD. Nerds are people (men) with barriers to "normal" socialization that substitute obsessive in-group social behavior for more common activities. Everyone else just didn't want to spend the time it takes to "build" a character and wage a campaign when they could be doing things that are interactive and in the real world. Role playing isn't a bad thing, but it is a replacement for having a role in the world.
I say that as a kid who read comic books, SF and bought toys during high school and college in the '80s. Those personal interests in no way impacted dating, acting, sports activities, etc that filled the rest of my time. That's why I was never viewed as a nerd. (And 'yes', plenty of people like me ended up as military officers.)
Was SFF in the basement in the '80s? Star Trek Next Generation, Star Wars, E.T., Batman, Superman, Close Encounters, Dragonslayer, Aliens, Terminator, Bladerunner, Legend, Wrath of Khan.
No. The '80s and late '70s was a boom time for SF, comic and fantasy in popular culture.
What people seem to misunderstand about the '80s is that the end of OPEC embargoes, large wars and many government business regulations made it a boom time after a long period of economic decline. The '60s counter-culture did not create a sustainable alternative economy, and most of those people settled down to normal economic activities - including consumerism.
What was revolutionary in the '80s was the rise of "alternative" pop culture. This appeared to start with music and expanded from there. Nowadays, it is easy to convince ourselves that the internet created the huge number of subcultures we have today, but really it started in the '80s because of the technology of that time - re-recordable cassette tapes, cable television, VCRs, personal Walkman stereos and the toll free phone numbers of mail order businesses. (That alternative culture was a gateway for acceptance of LGBTQ people in the mainstream.)
The frat boys of today bullying each other online about Avengers movies aren't "nerds". They are social people arguing about something as thoroughly mainstream as football, not "being nerds".
Today we have so many subcultures co-existing that actual nerds don't really stand out against the Goths, queer folk, etc that no one blinks an eye at anymore. That process started back then.