Imprisoned World Trade Center bomber Ramzi Yousef offered to cooperate with the feds — but backed out once a prosecutor showed up to interview him, court papers reveal.

The aborted terror squeal deal came to light in a court filing in which the terrorist’s lawyer lost a bid to get paid $23,000 for trying to get the terms of Yousef’s confinement eased.

In the papers, Manhattan federal Judge Kevin Duffy said he learned of Yousef’s offer in early 2010 when the attorney, Bernard Kleinman, sought funding to be by Yousef’s side in the “Supermax” prison in Florence, Colo., while the terrorist talked to prosecutors.

Duffy approved the request for travel expenses to Colorado after recalling how close Yousef was to Sept. 11 mastermind Khalid Sheikh Mohammed, and the knowledge he had of various terror plots.

“Though I have never been told exactly what happened at the prison, I understand that Kleinman’s trip to Colorado with the prosecutor went according to plan, except that Yousef evidently reneged on his offer,” Duffy wrote.