PORT-AU-PRINCE, HAITI, NOV. 25 -- Thousands of Haitians armed with clubs, rocks and machetes roamed the streets into the early morning hours today in spontaneous patrols against gunmen seeking to disrupt Sunday's national election.

At least four people were hacked, beaten or burned to death last night and today by mobs favoring the election. The mobs, called "vigilance brigades," have sprung up in an angry reaction to attacks, aimed at blocking the election, by groups of armed men who appear to be supporters of the deposed Duvalier regime.

In a communique that flashed across television screens tonight, the defense minister and government council member, Maj. Gen. Williams Regala, warned the "vigilance brigades" that keeping order is the "direct and exclusive" responsibility of the Haitian armed forces.

The communique said, "We will absolutely not tolerate any group that tries to substitute for the armed forces, who intend to carry out their duties by all possible means." Later tonight, trucks and jeeps carrying troops moved into the streets.

The nine-member electoral council, although facing huge logistical difficulties, security threats and lack of cooperation from government authorities, insisted that Haiti's first free balloting in at least 30 years will go forward as planned.

The events of the past 48 hours left painfully evident the absence of governmental officials willing to guide Haiti through the final days until the elections for president and a bicameral legislature. The vote could give this bloodied nation leaders to curb the anarchy left after the February 1986 collapse of the 29-year Duvalier dictatorship.

Yesterday, unidentified gunmen, believed by many to be former members of a Duvalier paramilitary force known as the Ton-Tons Macoutes, sped through the streets in civilian cars, firing guns into the air. One Haitian pedestrian was shot and killed, apparently at random, by a gunman in a passing car at midday yesterday on one of the capital's busiest avenues. Radio Haiti Inter reported that two more people were killed today in similar attacks.

Throughout last night, sporadic gunfire crackled in Port-au-Prince. The shots brought an immediate response from many neighborhoods: Haitians in the streets shouted and banged on bottles and metal light poles with their machetes to warn any Ton-Tons Macoutes away.

In the working-class neigborhood of Carrefour-Feuilles at about 10 p.m. yesterday, a carload of four men approached a barricade of rocks thrown up across a city street. One man got out of the car with the cry, "I am Haitian! Let me pass!" and began shooting a pistol into the air and into a crowd of several hundred people, according to a witness, laboratory technician Jeanty Joseph.

As his three friends fled, a mob closed around the gunman, slitting his abdomen with machetes, cutting off his hands and leaving him dead atop his car, Joseph and other witnesses said.

A lone man suspected by a crowd of being a police detective was beaten and stabbed to death downtown and his body was burned, witnesses said.

The U.S. Embassy said one of its vans, carrying employees, had been fired on Tuesday at a roadblock but that no-one had been hurt.

"There is no security for the election, so the population has taken its defense into their own hands," said Louis Roy, an adviser to the electoral council.

Washington Post staff writer David Hoffman reported the following from Santa Barbara, Calif.:

President Reagan issued a statement naming a U.S. observer delegation to the Haitian election and expressing concern about "the all-too-frequent violence which has marred the process."

The 15-member observer delegation is to be led by Roger Allan Moore, general counsel of the Republican National Committee.