This sounds like it could be Custom Robo.
It was likely on the PS2 or that generation of consoles...
Released in 2004 on the Gamecube, so it fits the described timeframe.
I think it was an RPG from Japan.
Afraid I can't match this part of the description - I'd describe it as an arena fighter, though wikipedia does call it an action-RPG. However, the game's character designs and writing do have a bit of a "stereotypical JRPG" feel at times, so I've occasionally heard people suggest that the game is reminiscent of a JRPG. Perhaps that could explain the discrepancy.
The setting would have been slightly futuristic.
Check. The game takes place in a futuristic city in which robots and other advanced technology are commonplace.
The main protagonist, a young man/boy...
Check.
his town (which had been secluded in some kind of structure)
The city is built inside a giant dome, see image below.
It was about a town of humans who weren't allowed to leave the town premises... They all believed that the world was flat. The main protagonist, a young man/boy, was allowed to leave the town for some reason. It was revealed to him that the world was not flat
Indeed. A government conspiracy has convinced the city's populace that the dome in which they live is the entire extent of the world, and that there's no "outside" to speak of. Notably, the "Flat Earth" element is explicitly brought up as a plot point in-game: the player first learns that something's wrong during a humorous scene in which you're asked whether the earth is flat or round. If you answer "round", the other characters mock you for not having paid attention in school.
when he left the town he came to realize that the world outside of his town... had been destroyed. The outside world was reminiscent of a post-apocalypse, fallout-style world...
Check. The Outside World (referred to by that exact name, in fact) is a fallout-esque blasted wasteland.
...which had other structures like the one his town was in.
There were a few comparably futuristic structures outside, but no other cities, and nothing similar to the dome.
Overall, there are a few bits that don't match, but enough elements fit that it seems like a fairly close match to the question's description.