INSIDE ITS COUNCILS and outside, the Reagan administration is experiencing some turbulence in shaping policy for the Iraq-Iran war. Good. The administration had not adequately prepared the rationale or operating guidelines for its new plan to ''reflag'' and escort Kuwaiti tankers in the Gulf. The attack on the USS Stark, mean and costly in American lives, changed all that: it precipitated the full-scale review that should have begun before the president, under pressure to compensate for secret dealings with Iran, moved last January to reassure the Arabs by beefing up the American fleet.

Senate Foreign Relations Chairman Claiborne Pell has put in a bill that crystallizes doubts about reflagging and will focus at least a limited debate of a sort the administration slipped past when it decided against invoking the War Powers Act. Mr. Pell believes it unwise to adopt the shipping of ''quasi-belligerent'' Kuwait, Iraq's ''ally, financier and port access point.'' He thinks that reflagging is dangerous and that, when it proves so, the public will halt it. Better, he believes, to go to the United Nations for an arms embargo on Iran, peacekeeping and diplomacy.

We think he's wrong and that there's an answer to him in the requirement to brace the frightened moderate Arabs, to strengthen whatever inclination revolutionary Iran may have to negotiate an end to the war and to keep Moscow from becoming Gulf protector by American default. Nor does Sen. Pell take account of the United Nations' record of frustration in the Gulf. Mr. Reagan, however, has centered his policy pleading on the implausible specter of early gas lines. He must do better than that to keep the Pell vote from embarrassing his policy.

Meanwhile, officials ponder the rules of engagement that should guide American ships protecting the Kuwaiti tankers. The shadow of Beirut, where American military men were given a mission that exposed them to heavy risk and orders that restrained their self-defense, necessarily overhangs the proceedings. This is the context in which the extreme option of preempting Iran's new but not-yet-operative missiles at the mouth of the Gulf comes up. Reading about it in the paper will no doubt convince some people that the whole Gulf exercise is just too chancy. The important thing, however, is that rules of engagement both serve an appropriate mission -- and the mission cannot be to go to war with Iran -- and address expected risks. It is awkward to thrash out these matters in semi-public, but this is the way to develop a sound policy -- and to ensure it will survive the next alarm.