City Council Speaker Christine Quinn’s office hid millions of taxpayer dollars by allocating grants to phantom organizations as a way of holding the funds to dole out political favors later – bogus bookkeeping that is the subject of city and federal probes, The Post has learned.

Among the dozens of fabricated groups that were slated to receive funds were the “Immigration Improvement Project of New York” ($300,000), the “Coalition for a Strong Special Education” ($400,000) and the “American Association of Concerned Veterans” ($422,763).

The total amount set aside in 2007 and 2008 for the fake organizations – which are each listed by name in the city budget after being inserted at the council’s request – was $4.7 million. In the two years, 30 phantom groups were listed, council aides confirmed.

The money, in effect, became a slush fund for the speaker and was later used at Quinn’s discretion to reward groups that were loyal to her and to fund favored council members’ pet projects, sources told The Post.

The scheme gave “the speaker a stash of cash with which to thank or pay off politically important allies or cooperative council members,” a source said.

Quinn insisted in an interview yesterday with The Post that all of the taxpayer funds were ultimately used for legitimate purposes.

The never-before-exposed practice of hiding the funds dates to 1988, council aides said last night.

“It was used at the speaker’s discretion,” said an insider who worked for the council at the time it was headed by Quinn’s predecessor, Gifford Miller. “People would come in and say ‘We need money for this or that.’ ”

Sources said it may have been started to make an end run around the City Charter, which requires that all funds be allocated at the start of the fiscal year. That limits the speaker’s ability to dole out monies throughout the year as needs arise.

In the interview, Quinn, who plans to run for mayor next year and has made “transparency” in budgeting one of her pet causes, admitted she knew some funds were being held in reserve, but learned only several months ago they had been allocated to sham organizations.

Quinn said she ordered that the shady practice be abolished and only recently discovered her staff had not complied.

“I was kind of sick over the fact that there were things listed in the budget that were not accurate and that my instructions to the staff were disregarded,” Quinn told The Post.

When she learned several months ago that the practice had continued, Quinn said she turned over information about the bogus bookkeeping to “appropriate authorities,” including the city Department of Investigation and the Manhattan US Attorney’s Office.

Quinn’s aides insist she blew the whistle on the practice, but authorities have been investigating some aspect of the council’s finances since last year, sources have said.

Quinn recently hired an outside law firm to help comply with requests from investigators for documents and information dating back several years.

In a development that sources said was tied to the scandal, two of Quinn’s top finance aides were either forced out or resigned earlier this year.