Michael Phelps had just finished up an 8-hour gambling session at a Baltimore casino before he was popped for DUI early Tuesday morning ... TMZ Sports has learned.
According to our casino sources, Phelps hit up the Horseshoe Casino around 5pm Monday afternoon ... and sat in a private VIP gambling room for hours ... finally leaving around 1am.
We're told Phelps was playing blackjack ... though it's unclear if he also played other card games that night. There have been several reports that he's big into poker.
Clearly, Phelps had been drinking inside the casino ... we're told his booze of choice was beer ... and when he was pulled over around 1:40am, it was just a few miles from the casino.
We're told Phelps is a regular at the casino ... in fact, he was just there last month playing poker.
We reached out to Phelps for comment -- so far, no dice.