A transformer fire near Penn Station yesterday afternoon caused two buildings and two trains to evacuate, according to witnesses and fire officials.

About 50 passengers riding the IRT lines were discharged from the station and 25 people were evacuated from 429 and 431 Seventh Avenue after FDNY got the call of the fire shortly before noon, according to the FDNY.

The majority of the people evacuated suffered smoke inhaltion and one had to be taken to St. Luke's Roosevelt, an FDNY spokesman said.

A straphanger, Midwood resident Mo Gelber, 43, said the Nos. 1 and 2 trains in the station were emptied out. An MTA spokesman could not confirm how many trains were discharged. Gelber said there were sparks and thick black smoke coming from the ceiling.

"There wasn't panic, just confusion," he said of the riders leaving the trains. "They didn't know where to go."

About 60 firefighters were on scene to put out the blaze and it was under control at 1:30. Trains bypassed the station for about two hours as the firefighters fought the fire.

The cause was still under investigation.