RUDBAR, IRAN, JUNE 23 -- Chanting prayers of mourning as they carried their dead through streets littered with broken brick and glass, the residents of towns devastated by Thursday's earthquake have begun the long and despairing task of rebuilding their homes and lives from rubble.

The death toll from the earthquake that rocked Gilan and Zanjan provinces northwest of the capital, Tehran, stood at 40,000, according to Tehran radio. But with much of the area buried under rubble and inaccessible to relief workers, it appears impossible to determine how many have actually died.

In Rudbar, for example, as many as half of the town's 20,000 residents are said by survivors and relief officials to be dead or missing. Three days after the earthquake, bodies still protrude from crumbled houses and corpses are buried in multiple graves without any formal counting.

The death toll is expected to rise as relief workers push into mountain villages surrounding this hillside city near the Caspian Sea. More than 100,000 have been injured, according to the United Nations. The International Red Cross has estimated that 400,000 have been left homeless.

Most of Rudbar and several nearby towns viewed during an aerial tour of the devastated region of northwestern Iran have been leveled by the earthquake, which struck just after midnight last Thursday morning, while most villagers were asleep in their homes or watching World Cup soccer matches on television.

The death toll is so high because homes in the northwest are generally constructed from mud bricks reinforced with straw. They crumbled completely in the earthquake, burying their occupants.

Aftershocks, some measuring as high as 4.0 on the Richter scale, continued to rumble through the region. There have been more than 200 aftershocks since the earthquake struck, Iranian government officials said.

Iranian relief workers and the Red Cross and Red Crescent organizations have delivered tents, blankets and food to hard-hit towns such as Rudbar that lie along roads partially blocked by landslides and collapsed tunnels. But the relief effort has not yet reached the hillside villages said by some refugees here to have been hit worst in the quake.

Injured children and women staggered on the streets of Rudbar or squatted forlornly in tents inside their former homes, now reduced to heaps of mud and scrap. Gravediggers wearing white scarves roamed with picks and shovels, burying the dead beneath small mounds.

There was a shortage of stretchers here, so when a dead 9-year-old girl was pulled from a pile of bricks, her body was wrapped awkwardly in a blanket and carried through the streets while relatives chanted prayers of mourning. Families loaded their belongings into cars and buses and inched along the jammed roads.

"There are many still alive under the rubble, but the villages are far away and on mountainsides, and the roads are all blocked," said Hadar Mirhussain, a relief worker who said he had not slept in days and spent his time wandering Rudbar with a pick slung over his shoulder, occasionally stopping to dig for bodies or survivors.

"We have been tested. I don't know why, but we have been tested," said Kohan Josani, 30, standing outside the ruins of his two-story home. Josani said 35 members of his extended family had been confirmed killed in the earthquake.

Iranian Revolutionary Guards and numerous volunteers continued to dig for survivors. But with square miles of the region in ruins and little heavy equipment available to move large obstructions, much of the relief effort centered on tending to survivors and refugees.

Collapsed tunnels and damaged roads continued to hamper relief efforts in the region, but progress was reported by Iranian officials in clearing roads and plowing detours through blocked mountain passes.

Planeloads of international relief supplies and teams of earthquake rescue specialists began to reach the northwest today. At an airfield in the city of Qazvin, which is being used as a base for the airlift operation, reporters counted 40 fixed-wing aircraft and 15 helicopters and were told that 25 of the planes had been chartered from Poland for use in the rescue effort.

In its appeals for international assistance since Thursday, the Iranian government has emphasized the need for heavy machinery such as cranes and bulldozers to help remove rubble and clear overland routes through the northwest.

On the highway between Tehran and the badly affected Zanjan province, dozens of trucks carried earthmovers and bulldozers on flatbed trailers from the capital. At Tehran's airport, helicopters and light aircraft lifted off with supplies and returned with wounded bound for the capital's hospitals. The Iranian government said it has so far carried out more than 1,500 airlift relief missions to the northwest.

Iran's ambassador to the United Nations, Kamal Kaharrazi, said Friday that Iran would accept international assistance from any country except Israel and South Africa. Some of that assistance has arrived in Iran in the form of European doctors and rescue specialists, Japanese structural engineers and a team of French rescue dogs trained to sniff out survivors buried beneath rubble.

The Geneva-based League of Red Cross and Red Crescent Societies is a serving as a conduit for much of the aid. The Red Crescent appears to have distributed thousands of tents in the devastated Rudbar area, although residents and Iranian officials say that in some regions the tents are of little use because high winds blow them over. Iran has appealed for donations of metal containers that can be used for housing, but even if available, these would be difficult to ship into the area.

{In Geneva, the League of Red Cross and Red Crescent Societies said 18 relief flights from 20 member societies were scheduled to arrive in Iran during the next three days carrying 124,000 blankets, nearly 5,000 tents and other relief items, the Reuter news agency reported.}

Some residents of the Rudbar region complained of problems in the coordination of relief efforts. "There is some problem as to food distribution here -- especially for us at the end of the line," said Hadia Bakian, a 30-year-old welder whose house collapsed moments after he and his family escaped into a courtyard. "Instead of arguing over differences, we should concentrate on making progress."

But despite problems of coordination between provincial and federal authorities, Iran's tightly controlled Islamic revolutionary government appeared today to be responding well to the crisis, using Revolutionary Guards to help organize relief convoys, opening its borders to assistance from Western adversaries such as Britain and the United States, and establishing a system for evaluating and evacuating the wounded from the earthquake region.

In Tehran today, while traffic moved normally and restaurants and shops were open, images were visible of the capital on war footing: Wailing relatives congregated at the city's hospitals, public prayer meetings were called to console the populace, and tables were set up in front of the capital's many mosques to accept contributions.

But the deepest scars from the earthquake lie not in Tehran but behind the barren mountains that stretch north and west from the city. From the air, in a helicopter tour arranged by the Iranian government, reporters saw villages and towns virtually razed. Fault lines from the earthquake were visible at places in the hills, where new canyons were carved into the sides of mountains. Rows of trees in the region's famous olive orchards had fallen flat.

Despite the widespread devastation, the region was fortunate on several counts. Near the town of Manjin, a large dam that looms over a river valley filled with villages held firm during the earthquake and aftershocks. Power lines and some communications remain intact. And several sizable factories in industrial towns just 70 miles from the earthquake's epicenter appeared to have suffered little damage.

The Iranian Interests Section is accepting cash donations and requesting specific medical supplies and foods. Cash donations can be sent to Iran Quake Relief Assistance, Bank Melli Iran, Account No. 5000, 628 Madison Ave., New York, N.Y. 10022. Supplies should be sent to the Iran Quake Relief Center, Interests Section of the Islamic Republic of Iran, 2209 Wisconsin Ave. NW, Washington, D.C. 20007. Phone (202) 625-1449 for details.

Adventist Development and Relief Agency will accept cash donations. Send checks to 12501 Old Columbia Pike, Silver Spring, Md. 20904; telephone 680-6340

American Jewish World Service, cash donations. Send checks to 1290 Avenue of the Americas, 11th floor, New York, N.Y. 10104; telephone (212) 468-7380

American Muslim Council, cash donations and medical supplies. 1212 New York Ave. NW, Suite 525, Washington, D.C. 20005; telephone 789-2262

American Red Cross will accept cash donations. Make checks out to the American Red Cross and note that funds are intended for Iranian relief efforts. Donations can be mailed to the American Red Cross Disaster Relief Fund, P.O. Box 37243, Washington, D.C. 20013. Call (800) 842-2200 for information.

Americares of New Canaan, Conn., is preparing to airlift medicines and relief supplies. Call (800) 486-4357 for information.

Baptist World Alliance, cash donations to Iran Earthquake Fund, 6733 Curran St., McLean, Va. 22101; telephone 790-8980

B'nai B'rith International, cash donations, 1640 Rhode Island Ave. NW, Washington, D.C. 20036; telephone, 857-6600

Lutheran World Relief, cash donations, 390 Park Ave. S., New York, N.Y. 10016; telephone (212) 532-6350

U.S. Committee for UNICEF, cash donations, 333 E. 38th St., New York, N.Y. 10016.

World Concern, cash donations, P.O. Box 33000, Seattle, Wash. 98133; telephone (206) 546-7201