Tough to rank them as most 2d Mario games are quality games. I will give it a shot though just for fun.
Super Mario Bros. 2 - Some of this may be nostalgia but I really loved this game and it really stands out from other Mario games still to this day. Doki Doki Panic was so impressive that not only was it allowed to pretend to be a Super Mario Bros game but the franchise even borrowed elements from it that we still see to this day.
Super Mario Bros. 3 - If Doki Doki Panice didn't exist, this could have been the perfect SMB 2. It's a bigger, badder, better in every way version of the first game. Whereas Doki Doki Panic was a fresh game that took the series in new directions, this was the tried and true formula of the first game ramped up to 11, honed, refined, and perfected. Even Super Mario World wasn't THIS good.
Super Mario World 2: Yoshi's Island - A fantastic, fun game that laid down the mechanics that would become the foundation of the Yoshi games.
Super Mario Bros. Wonder - The best of the more modern 2d Mario games by far and I'm actually tempted to rank it higher because it's just that fucking good.
Mario vs. Donkey Kong - Addicting puzzle/platform gameplay that reminds you of the old days of Mario and DK fighting it out in the arcades with rolling barrels and invincibility hammers. It's a wonderful throwback and it paved the way for what's next on my list.
Any of the Mini-Mario games - I love all of them and they are ridiculously addicting.
Super Mario World - It's low on this list I know, but I'm sorry. When Sonic came out it was hard to give a shit about SMW, especially since it was mostly just rehashing the same old stuff. It also wasn't as impressive as Super Mario Bros. 3. SMW 2 blows its predecessor out of the water too. Even the Donkey Kong Country games impressed me more than SMW back in the day. I'd rather pick up one of them and play it again than play SMW again. Mario got his ass handed to him in the 16-bit era by both Donkey Kong and Sonic and it took Yoshi's help to make me care about the fat little plumber again in SMW 2.
Super Mario Land - Lots of nostalgia here as this was one of the earliest games I played the GB, but it's pretty medicore when compared to other 2d Mario games.
Super Mario Bros. - A classic and one of the most important video games ever made, but not very impressive nowadays.
I think those are all of the ones I've played