With less than two weeks before the primary election, billionaire media magnate Michael Bloomberg has spent a record $20 million in his bid for mayor, according to campaign documents released Friday.

Bloomberg, a Republican, is financing his own campaign. The four major Democrats and one other Republican contender are participating in the city's campaign finance program, which limits candidates' spending to $5.5 million on the primary.

In the 21-day period ending Aug. 27, Bloomberg spent $3.8 million, including $2.4 million on television, radio and print advertising.

The $20 million he has spent during the campaign exceeds the $13.7 million spent by Ronald Lauder during his unsuccessful 1989 campaign.

The Democratic contenders have been holding onto their money to pay for ads closer to the Sept. 11 primary.

City Council speaker Peter Vallone had $2 million left to spend; Bronx Borough President Fernando Ferrer had $1 million; and Comptroller Alan Hevesi had $1.9 million.

Public Advocate Mark Green, who leads in most polls, had only about $200,000 left, but has bought $1 million worth of air time for television and radio ads.

During the reporting period, Republican Herman Badillo finally reached $250,000 in campaign contributions, the minimum a candidate needs to get matching funds.

For months, Badillo has run a bare bones campaign that has made him a heavy underdog to Bloomberg.

The two GOP candidates squared off in a low-profile debate Friday that was aired by a single public radio station.

Bloomberg tried to swat away criticism of his campaign spending.

"It's ridiculous to think that you can buy an election," he said. "All you can do — and if you're an outsider you have to have some money to do it — is go and tell people who you are, look 'em in the eye."

Badillo said voters "should be outraged" by Bloomberg's spending, adding that his rival "is nullifying the campaign finance laws of New York City.

If the winner of the Sept. 11 Democratic primary does not get 40 percent of the vote, the top two finishers will take part in a Sept. 25 runoff. The general election is Nov. 6.