Batman’s been robbin’ the house.

Forthcoming “Batman” star Ben Affleck — who was banned for life from playing blackjack at the Hard Rock Casino in Vegas — has been cleaning up at the game for years.

The Hollywood high-roller, booted for counting cards, had hit it big playing “21” at the very same casino, raking in a total of nearly $1 million in two trips.

The Oscar winner won $140,000 in a single sitting while playing with pal Matt Damon in 2000, The Post reported at the time.

A year later, he won $800,000 while playing three simultaneous hands at $20,000 a pop.

With $75 million in net worth, the 41-year-old actor is in it more for adrenaline than for money.

He gave away every one of his $140,000 in chips to casino staffers on the 2000 trip — tipping his dealers, waitress and door boys as much as $5,000, sources told The Post.

He hasn’t had the same luck with poker.

Affleck ran into trouble when he hosted a regular Hollywood poker game for A-listers in a posh cigar bar in Beverly Hills, Star magazine reported.

“Ben’s Game” was high stakes and drew such luminaries as Damon, Leonardo DiCaprio, and Tobey Maguire to the Grand Havana Hotel.

One night “Ben busted big” — betting too much on a bad hand — and was forced to fork over $400,000 to movie mogul Ron Meyer, a source told the magazine.

“At the time, Ben wasn’t the most skillful player,” the source said.

“It was almost like he was someone who felt [he] did not deserve the money [he] had,” the source said.

“During the time period at the Havana Room, though, J.Lo would call all the time desperately trying to track down her fiancé,” the source added.

The star had better luck in 2004, when he won the California State Poker Championship.

He took home $356,000, which qualified him for the 2004 World Poker Tour final tournament.

He has since competed several times in the tourney but has never won any cash, despite top-notch training from poker superstars such as Iranian-born poker whiz Amir Vahedi, and his personal coach, Annie Duke, who was accused of being involved in an online poker cheating scandal in 2008.

Last Tuesday, Affleck was playing blackjack at a high-rollers table at the Hard Rock when guards approached, called him an “advantaged player,” phoned for a cab and asked him to leave.

Counting cards at blackjack isn’t illegal but many casinos forbid it.

It involves keeping a mental count of cards that have been dealt and cards that remain in the deck to determine when to increase or decrease a bet.

A spokesman for Affleck didn’t return calls seeking comment on Saturday.