Hundreds of heavily armed law enforcement officers, many in riot helmets, swiftly sealed off the area around Iran's embassy here yesterday in a vivid and dramatic move designed to keep watch on the 15 diplomats there and ensure their departure.

The massive show of force cut off evening rush-hour traffic on Massachusetts Avenue along Embassy Row and underscored for Washingtonians the immediacy of the president's order closing the embassy and expelling the diplomats. The operation is expected to continue around the clock until the order is carried out.

Officers barricaded Massachusetts Avenue above and below the embassy turning back almost all motorists and pedestrians, and declaring the five-block strip between the roadblocks to be a "secure zone." Nobody moved inside it last night without a police escort.

Helping evoke an atmosphere of excitement and uncertainty, policemen on motor scooters and in flak jackets set on curbside command posts and took positions behind and in front of the embassy. Dozens of FBI agents, equipped with closed circuit television gear and sets of identification photos, also manned roadblocks or watched the embassy door, awaiting the diplomats' emergence.

Teams of four FBI agents were assigned to follow each of the 15.

While it created tension for some Washingtonians and inconvenience for others, the massive police operation on Embassy Row had one main purpose, according to a State Department spokeswoman:

"To be sure that they [the Iranian diplomats] leave" as ordered. Under routine, but rarely used procedures for closing a foreign embassy, she said, personnel are allowed to travel only from their offices to their homes, or "to make arrangements to leave."

In referring to the police presence on Massachusetts Avenue, however, Deputy D.C. Police Chief Robert Klotz said it was also intended to keep passing pedestrians and motorists from being "involved in anything the Iranians might decide to do."

Klotz, head of the D.C. police special operations division, who arrived on Embassy Row even before the president's speech yesterday, told reporters, "We don't know how they [the embassy personnel] are going to react to the president's statement."

Iranian charge d'affaires Ali Ahah spoke briefly to reporters outside thee embassy. He claimed that he had been insulted yesterday at the State Department, but indicated he would leave.

There was little visible activity at the embassy itself afterward. At 3:31 p.m. a man with a briefcase went inside. He left seven minutes later. Police said he came from the State Department and carried the formal eviction notice.

An unidentified man who answered the embassy telephone was asked by a reporter when the diplomats would leave. "Ask the State Department about that," he said. "They control it. They control everything." Then he hung up.

In the first hours after police blocked traffic at Waterside Drive, south of the embassy, and the 31th Street north of it, there was no indication of any disorder. However, yesterday's fast-moving swirl of events did cause confusion.

When first sent to the embassy and told it was to be evacuated, some police officers reportedly believed they were to clear it of demonstrators. Possibly contributing to the false impression was the presence near the embassy of about 250 persons, most describing themselves as Iranian, who were protesting the visit here of Egyptian President Anwar Sadat. They attracted a smaller group of counterdemonstrators.

The anti-Sadat demonstrators completed their protest without incident a few feet below the point where police had sealed Massachusetts Avenue.

Police said late last night that Massachusetts Avenue traffic headed downtown today will be detoured along Garfield Street to Connecticut Avenue.

They said northbound traffic could avoid the sealed area by using Florida Avenue to reach Connecticut Avenue or by using Q Street to reach Wisconsin Avenue.

Pedestrians and joggers as well as motorists were turned back on Massachusetts Avenue yesterday at the double checkpoints, which required them to pass scrutiny first by D.C. police, then by FBI agents.

Only those who could prove they lived or worked in the "secure zone," or had earlier parked their cars inside were allowed to enter.

At least one resident of the secure zone denied that it posed a problem for her.

"How can we be inconvenienced if it is necessary?" asked Edna W. Macomb. "We're a military family, and we do whatever is necessary, whatever the president feels is right. It's good to see a show of force for a change." She said she had been forced to detour while driving home yesterday but "I've had to do that before in storms and things."

One person who did admit to feeling inconvenienced, however, was Patricia McElroy, who was returning on foot to her Idaho Avenue Avenue NW home from the job at a downtown law firm.

After being turned back, she said she faced a long detour. "A lot of people use Massachusetts Avenue to walk home," she said. "I don't know what we'll do now."

Police had said officially they sealed as much as five blocks of the avenue to aid in diverting traffic and because of uncertainty about an Iranian reaction or possible demonstrations by American citizens.

Privately, some indicated the belief that the Iranians were heavily armed. Asked whether weapons were kept in the embassy, one city police official said: "They've got plently."

At least one Embassy Row diplomat was overheard being advised on the matter by an official in the Uniformed Division of the Secret Service, which is responsible for protection of diplomatic premises here.

"These people [the Iranians] are heavily armed," the officer told a Bolivian whose embassy is across the street from Iran's. "If there should be any type of disturbance, I want you all to go inside and stay behind the wall."

Last night a car carrying persons from the embassy reached a checkpoint at the north end of the sealed zone. After some discussion it was allowed to pass. Two automobiles carrying FBI agents moved off into the night behind it.