NEW YORK — A former madam running against former Gov. Eliot Spitzer in the race for New York City comptroller peddled hundreds of powerful painkillers and other prescription pills in exchange for Ecstasy and cash from a drug dealer wearing a wire, federal authorities said Tuesday.

Prosecutors made the accusation against Kristin Davis while announcing her arrest on charges of distributing and possessing a controlled substance.

Davis, 38, was released on $100,000 bond and ordered undergo drug testing at her initial court appearance on Tuesday. She left court without speaking to reporters.

In a statement, defense attorney Daniel Hochheiser said his client "is accused by hearsay complaint, based upon the unsworn statements of an admitted drug dealer, who is seeking leniency at the expense of a high-profile target."

The long-shot Libertarian candidate is perhaps best known for claiming to have gotten call girls for Spitzer before a prostitution scandal forced him from office. But the claims have never been proven.

According to a criminal complaint, Davis began buying Xanax, Adderall and Ecstasy from the unidentified drug dealer in 2009. She allegedly told the dealer that 'she provided these drugs to others at house parties,' the complaint says.

In 2011, Davis asked the dealer if he would accept Adderall in exchange for Ecstasy, the complaint says. After that, they traded 240 Adderall pills for 120 Ecstasy tablets, it says.

Authorities arrested the dealer in December and he agreed as part of guilty plea to record his conversations with Davis, the complaint says. In a recorded meeting on Jan. 7, the cooperator paid Davis $675 in cash for 215 pills, it says.

"OK, and this one is Ambien. There are 30 of those," Davis allegedly said on tape.

Authorities also alleged that in April, Davis brokered a deal for another person to sell 180 oxycodone pills to the cooperator. The complaint references a video that shows Davis bringing the person to the dealer's apartment, where the dealer used $3,600 provided by the FBI to make the purchase.

Davis' bids for office have openly capitalized on her notoriety, her allegations about Spitzer and her made-for-reality-TV persona. But she has said she plunged into politics to promote personal freedoms — in her view, that includes legalizing and taxing marijuana and decriminalizing prostitution — and to provide competition for what she sees as career politicians.

She drew a credible 20,429 votes for her Anti-Prohibition Party in the 2010 governor's race; a party needs at least 50,000 votes in the governor's race to be guaranteed a spot on ballots.

Davis announced her candidacy for comptroller in April. She said she was running because there was then little competition on the horizon for Democrat Scott Stringer, a former state assemblyman who is currently Manhattan's borough president.

Then Spitzer jumped into the race last month — and Davis welcomed it.

"This is our next city comptroller?" she said at the time. She noted that she went to jail for promoting prostitution; Spitzer was never charged, although he has acknowledged patronizing call girls.

Spitzer and Stringer's spokespeople declined to comment on Davis' arrest. Representatives for other candidates didn't immediately respond to inquiries