Some Long Island Rail Road passengers are being forced to commute on a dingy old train with broken air-conditioning — because the newer rides have been allocated to the pampered Hamptons crowd for the summer.

“I guess the richer people get to have the air-conditioning before me,” griped Lisa Ludwig, 51, of Huntington as she boarded the aging train on the Port Jefferson line.

Northport commuter Judy Roberts, 58, said that when the train first pulled into her station, “I was like, ‘What is this?!’ This equipment is from the 1950s!”

The MTA rented the train from Maryland’s rail system — Maryland Area Regional Commuter (MARC) — and put it on the Port Jefferson line so that the agency could move more diesel trains to its Montauk line, according to MTA spokesman Aaron Donovan.

That line serves the Hamptons beach community, a mansion-riddled magnet for tourists.

The old MARC train first appeared on the Port Jefferson line a week ago, disappointing commuters who are already frustrated by chronic delays caused by infrastructure problems at crumbling Penn Station.

Right out of the gate during a very hot week, the air-conditioning was broken in some cars, forcing riders to either swelter or cram into crowded, cooler ones.

“On top of borrowing trains, we’re borrowing trains that don’t work,” Roberts quipped.

The MTA paid $670,000 to rent the train, Donovan said, adding that it’s the first time the LIRR has used another agency’s train.

Donovan said the Port Jefferson line drew the short straw over the Hamptons because the MARC train carries fewer passengers, explaining:

“Bringing in additional cars — all of which have air conditioning — allows the LIRR to provide additional seasonal service to support Long Island’s important tourism industry.”

Additional reporting by Caroll Alvarado