It is the same model, same cockpit set, and same full sized prop. We can assume that in the year between TESB and ROTJ that someone went back to Bespin to get it. The new official canon is that Lando and Luke went back after they found out Han was delivered to Jabba. Luke looked for his saber, but retrieved his X-wing.
Alternatively it would be pretty easy to have a different X-wing painted to match the original.
The X-Wing thing has never bothered me for exactly this reason. The markings on Luke’s X-wing are clearly from a template used by various squadrons across the Alliance. Luke’s identical pilot helmet in ESB and ROTJ, on the other hand, is something of a headscratcher.
And come to think of it, why didn’t the X-Wings in ROTJ have colors that matched their squadron designation? In SW 1977 the X-Wings of Red Squadron were painted red and the Y-Wings of Gold Squadron were painted yellow/gold. ROTJ changed the squadron names but not the paint jobs.