If you're stuck with lemons, make lemonade. That folk wisdom applies to U.S. policy in Iraq, which is as seedy and sour as any foreign policy challenge America has encountered in decades. We certainly aren't making champagne there, but how are we doing in the lemonade business?

As we head into the final month before the handover of sovereignty to the Iraqi people, I'd like to offer the contrarian thought that the Bush administration in the past few weeks has been meeting the lemonade test fairly well. It is correcting earlier errors of judgment and putting policy on a reasonable glide path. That doesn't mean the plane won't crash after June 30. But President Bush's recent moves haven't been as foolish or feckless as some commentators have suggested.

The best example is the decision to jettison the Pentagon's former darling, Ahmed Chalabi. The longtime Iraqi exile is a remarkable man -- one of those stubborn, self-motivated missionaries who by the force of their personalities bend the shape of history. Without his advocacy for regime change in Iraq, I suspect Saddam Hussein would still be in power.

But watching Chalabi on the TV talk shows last weekend after his headquarters had been raided in Baghdad, indignantly demanding a congressional showdown between himself and CIA Director George Tenet, it seemed that his ambition had overwhelmed his judgment. He apparently believed he could mobilize his supporters in Washington to attack the administration that had helped fund his operations but had now turned against him.

Chalabi posed three problems for U.S. lemonade makers. The first was that by steering many economic portfolios to his allies, he had gathered too much power over the nascent Iraqi economy.

The second problem is Chalabi's Iranian connection. He has never made any secret of his close ties with Tehran, but the issue became more serious after reports that Chalabi's intelligence chief, Aras Habib, was suspected of being an Iranian agent.

Support for this allegation comes from former CIA officer Bob Baer, who told me that he was informed by colleagues in 1994, when he was part of the agency's Iraq Operations Group, that the U.S. government had solid intelligence that Habib was secretly being paid and controlled by the Iranians and was informing them about American covert activities in Iraq. Baer said that in 1999 he passed a warning about Chalabi's Iranian connections to Douglas Feith, who later became the Bush administration's undersecretary of defense. Chalabi has denied providing intelligence to Tehran, and Habib has disappeared.

You have to wonder what Chalabi's neoconservative enthusiasts were thinking backing a man who had been so closely allied with an Iran that arguably poses the biggest strategic threat to Israel. If there's a logic here, it eludes me.

I suspect that Chalabi's ultimate transgression was pushing to position himself as the political representative of Iraqi Shiites -- the key constituency in the new Iraq. That was a sensible strategy for Chalabi, but it increasingly put him at odds with U.S. policy -- and made him a kind of up-market, secular version of the hotheaded young Shiite mullah, Moqtada Sadr.

Heading toward the June 30 transition, U.S. officials apparently felt it was important to let Iraqis know that Chalabi wasn't America's man. By cutting off his Pentagon funding (and conniving in the raid on his headquarters) they probably hoped to open space for other Shiite leaders who will emerge in the transitional government to be named soon by U.N. special envoy Lakhdar Brahimi.

The secret to making Iraqi lemonade is maintaining Grand Ayatollah Ali Sistani's support for a transition jointly supervised by the United States and the United Nations. Despite Chalabi's efforts to derail that process, both Brahimi and U.S. occupation chief L. Paul Bremer seem to be making the relationship work. The best evidence has been Sistani's acquiescence while U.S. troops pummeled his enemy Sadr.

Iraqi lemonade will be a mix of different flavors and local solutions. It will mean adapting U.S. policies to the political realities of Sunni Fallujah and Shiite Najaf. It will mean including recycled lemons who served in the old Iraqi army and bureaucracy; it will mean accepting advice from lemonade tasters in France, Germany and elsewhere.

The concoction won't be sweet, and it may yet explode in the bottle. But this is the messy art of the possible, and the Bush administration at least is learning from its mistakes.

davidignatius@washpost.com