An undercover drug enforcement agent testified in court yesterday that an accused drug dealer told him the political turmoil in Iran made it easier to smuggle millions of dollars worth of nearly pure heroin out of that country.

"It is best to fish when the water is muddy . . . that is an old Persian saying," the agent quoted Shahrokh Bakhtiar as saying. Bakhtiar, a son and cousin of two of the highest ranking officials under the deposed shah of Iran, was referring to the confusion that followed the shah's overthrow last year, according to the agent, Kenneth C. Feldman.

Bakhtiar and Mohammed Roshan went of trial in U.S. District Court in Alexandria yesterday on charges of conspiracy and distribution of heroin that has an estimated street value of $32 million.

Federal officials said when the two were arrested Feb. 6 that the nearly seven pounds of heroin seized at the same time had the highest level of purity and was the largest quantity of the drug ever confiscated in the United States.

Bakhtiar, a part-time car salesman who lives in Hyattsville, and Roshan, owner of the West End Restaurant in the District of Columbia, have pleaded innocent. A third man arrested along with them, Reza Mianegaz of Springfield, pleaded guilty to two racketeering charges last month and is awaiting sentencing.

Bakhtiar was "involved in heroin" only because he was "enticed for $5 million" by federal agent Feldman, said Bakhtiar's attorney, Louis Koutoulakos, in an opening statement to the jury. The 5 million figure was the amount that was to change hands in a heroin deal.

"But human nature is what we're talking about . . . and when you tread on human weakness you are treading on disaster," Koutoulakos said.

Charles Work, an attorney for Roshan, attributed his client's prosecution to "guilt by association." He said Roshan gave money to Bakhtiar only in repayment of a loan rather than because of heroin dealing.

During Enforcement Agency agent Feldman, 33, spent most of the day on the witness stand. He said he met Bakhtiar through an unnamed mutual friend and pretended to be a member of a New York organized crime "family" that regularly invested its cash profits in "gold, Persian rugs" and other commodities.

At the end of their first meeting last Oct. 3, Feldman testified, they began talking about heroin and Bakhtiar gave him a packet of brown powder to demonstrate the quality of heroin he could deliver.

Feldman told the jury that in subsequent conversations, many of them tape recorded with court permission, Bakhtiar told him he was thinking of chartering a plane to go from Iran to Rome with pure heroin.

Bakhtiar said he had access to heroin factories in Tehran and that his family name was "like Rockefeller's" in the U.S., Feldman testified.

Bakhtair's father, Teymour Bakhtiar, founded the shah's secret police force, SAVAK, and his cousin, Shahpour Bakhtiar, was prime minister when the shah was overthrown, Feldman said.

"The shah got too big for his britches," Bakhtiar told Feldman in one taped conversation played in court yesterday, explaining the shah's fall from power.

Bakhtiar gained confidence in Feldman in a series of meetings at expensive Washington area restaurants, the agent testified.

Finally, Feldman testified, he arranged to purchase 20 kilograms (44 pounds) of pure heroin for $5 million. At a bank vault at L'Enfant Plaza on Feb. 6 Feldman said he and another agent brought $1 million in federal funds to make the deal -- all they were able to produce -- and Bakhtiar brought only three kilograms (6.6 pounds) of heroin to the meeting.

Bakhtiar said the remaining 17 kilograms would be delivered later, according to Feldman, who said he was unable to learn the location of those narcotics from Bakhtiar before arresting him on the spot.

The trial is expected to continue all week.