Hardened Afghan guerrillas, sleeping in caves and armed with legendary courage and a ragtag assortment of outdated weapons, are fighting a lopsided Islamic holy war against the modern Soviet military machine sent to control western Afghanistan.

With their century-old British rifles and captured Afghan Army carbines, Moslem partisans are little match for soviet tanks backed by MIG fighters that have, by the rebels' own admission, gained mastery of such regional centers as Herat, Farah and Shindand along with the neighboring airbases and connecting highway.

A four-day trip into Afghanistan with the rebels took a small group of correspondents between Soviet positions and into the rebels' mountain redoubt in the Farah area.

The journey showed that the Afghan guerrillas can, despite inferior weapons, effectively prevent complete Soviet control outside principle cities and interdict travel -- except for armored convoys -- even on main roads.

The rebels are being bolstered by the arrival of rifles from Afghan Army stores, reportedly turned over by regulars angered at the new Soviet presence. The guerrillas claim that the soldiers themselves would join the movement if it were more organized and quick to absorb them.

It apparently was the rebels' ability to mount similar resistance against the former government of Kafizullah Amin, along with that of parallel guerrilla groups in the eastern border regions near Pakistan, that prompted the Soviet Union to send nearly 50,000 troops last month to crush opposition to the Moscow-oriented rulers it favors for Kabul.

The rebel leaders of western Afghanistan, unable to get supplies over the Iranian border and too far from Pakistan, appealed for direct supply of rocket-propelled grenade launchers and antiaircraft batteries from any country willing to help. They declared that with such weaponry they could do much more against the traditional Soviet Army in these craggy "mountains of the white earth" where they have their lairs.

Nevertheless, after nearly a year of fighting against the government in Kabul and, now, against Soviet forces, the Farah guerrilla movement has formed three fronts, each with several groups, totalling more than 3,000 full-time partisans living in mountain hideaways, their commander said.

They could recruit more peasants to increase their ranks but have no weapons or ammunition to offer them, he added.

For these peasant warriors, who long have struggled against central Afghan authority and foreign domination, the Soviet presence has added a religious element to their struggle.

Reflecting this theme, the overall field commander at one guerrilla base was an imam, or head priest. In a late-night conversation with visiting correspondents he spoke Pashto, one of Afghanistan's two main languages along with a strain of Persian. His remarks were translated into Persian by an Afghan student and then relayed into English by a Swiss student of Persian literature who accompanied the correspondents.

The struggle against the Soviet internvention is a holy war, he said, his intense black eyes reflecting the light of a coal lamp on a carpet in his tent. iAfghanistan's revolt is similar to the Islamic revolution against the shah and his American supporters next door in Iran, he added.

The imam, as did all other guerrilla leaders interviewed, requested that his name remain a secret -- for fear, he said, of reprisals against his family. h

He and most of the guerrilla leadership in the Farah area have been in the back-country mountains fighting what they call "communism" for about a year now. Their opposition began with the coup mounted by Nur Mohammed Taraki in April 1978, which they interpreted as a sellout of Islamic values to Soviet ideology. It grew into armed rebellion as the changes brought about by Taraki and his successor Amin were felt in the deeply religious contryside.

"I understand that Taraki was against Islam, that he was a communist, and that he was bloodthirsty," said a former Air Force officer who founded the Farah region's front.

Two of his followers -- wizened old farmers who called themselves guerrillas in search of weapons -- conplained that government agents came to their village and forced men and women alike to learn to read socialist propaganda.

"The Russians are playing with fire," said a former high school principal and chemistry teacher turned guerrilla leader. "If we had weapons, we could take them.The only thing we need is weapons. We don't need intervention of any kind."

Despite its Islamic fervor, neighboring Iran has offered no assistance other than turning a blind eye to partisan comings and goings across discreet sections of the 400-mile border, guerrilla leaders complain. Indeed, they said, border surveillance has increased since the shah was driven from power a year ago and ayatollah Ruhollah Khomeini's Islamic Republic took over.

"What kind of Islam is this Islam of khomeini's, who has never personally condemned the Russian invasion of Afghanistan, while other countries near the Soviet Union, such as Romania, have condemned it?" the former prinipal asked bitterly.

He was speaking along with the two field commanders -- the imam and the former Afghan Army colonel -- to visitors at a regional rebel headquarters on a shelf of rock. It was at the back end of a box canyon created by jagged stone walls soaring hundreds of feet toward the clear, cold night sky.

Sprinkled around the canyon, a half-dozen campfires fluttered at entrances to caves or tents as the rebels sought shelter from the nighttime cold. Sentries stood duty at the canyon's opening onto a long, rocky expanse of desert-like terrain stretching for miles between rows of sharp limestone peaks.

The ability to sleep on rocks under a single blanket and survive on a diet of bread and cheese -- supplemented by by an occasional chunk of mutton -- gives the guerrillas their advantage over the Soviet Army, and before it the Afghanistan Army.

Their firepower is limited almost to the point of being derisory. Most carry rifles rejected long ago by armies of other countries. Ammunition is so scarce that some rebels make their own.

One rebel displaed a long Russian pice dating from czarist times, with 1893 stamped on the breech. Another showed off a British cap-and-percussion rifle apparently left over from Britain's fruitless attempt to subdue the Afghans at the beginning of the century. On the breech were engraved the letters "Vr", for the Latin "Victoria Reginia," or Queen Victoria.

Others, however, carried the ubiquitious Soviet-designed Ak47 assault rifle, the Kalashnikov, its curved clip and functional from contrasting with the white turbans and baggy pantaloons worn by most guerrillas under surplus army overcoats.

Some of the outewear came from U.S. used-clothing shipments, including a khaki jacket with a U.S. Park Service patch that was the pride of an aging rebel. A lucky few brandished captured Russian tommy guns, with blunt ventilated barrels and round magazines.

The heaviest weapons seen in the rebels' possession in the Farah area were the captured Soviet equivalent of a BAR light machine gun and one recently purchased shoulder-fired grenade launcher of Soviet design. Also in the rebel arsenal were homemade ines for use against tanks and make-shift hand grenades fashioned from lead pipe joints filled with explosives and capped at both ends, with a fuse sticking out one side.

When the group posed for a reporter's camera with their weapons one guerrilla held a stone, another a miner's pick and a third a riding quirt wrapped in scarlet and green ribbions.

Medical supplies simply do not exist. Nor do doctors and medics. "We don't even have one pill," said the defected Army colonel who provides military expertise at the camp.

Guerrillas picked their way through rocky peaks in the traditional clothes of Afghani peasants. Their footgear ranges from tennis shoes to suede boots to pieces of carpet tied to a leftover rubber sole. One rebel was seen limping along the trail with one foot bare and other half inside a collapsed leather sheo whose heel flapped against his foot with every slow step.

Despite their limitations, guerrillas claimed several recent successes in encounters with Soviet troops occupying their region. A raiding party of 16 rebels riding motorcycles killed the local governor in Kandahar last week and induced a number of Afghan soldiers to defect with their weapons, their commander said.

Also last week, rebels destroyed two Soviet trucks in an ambush of a convoy betwen Herat and Kandahar, they added. Another group that made contact with a dissident army group near the same road was seen returning to camp Sunday morning with about 40 Afghan Army carbines.

The regional rebel commander, a 40-year-old former Afghani Air Force officer trained as a pilot in the Soviet Union, said at his base camp in a rear area that the main hope for accumulating an arsenal lies in persuading regulars to turn over weapons. The number of Afghan soldiers willing to do so has increased sharply since the Sviets intervened massively Dec. 27, he added.

Rebel leades reported that Soviet troops airlifted into an Afghan air base near Shindand disarmed Afghan soldiers stationed there to prevent their weapons from getting into guerrilla hands.

Even in recounting these exploits, however, rebel leaders acknowledged that Soviet troops have a firm grip on the region's major towns and roads. Soviet tanks patrolled the roads, they said, and Soviet trops have pitched tents along the way to maintain constant guard against raids on convoys.

The guerrillas fear to move in vehicles during the day except in areas where steep mountains protect them from Soviet aircraft. The sound of a jet on Saturday sent rebels ducking behind a dirt wall. It was the only plane seen during four days in western Afghanistan but several 12-footwide bomb craters testified to earlier attacks.

Guerrillas say that Soviet artillery shelled a mosque in the Nuristan area last week as more than 200 persons prayed, included 35 guerrillas. All were killed and the mosque was leveled, the reports say.

Similarly, guerrillas say Soviet troops gunned down 3,000 Afghan soldiers from an elite unit in Kabul when they tried to resist the Soviet intervention. Sixty truckloads of bodies were said to have been seen leaving the unit's barracks near the prime minister's residence.

These reprots filtered through a number of sources before reaching a field comander who passed them on, however, and their accuracy appeared limited by lack of reliable communications between rebel fronts. Only a few guerrilla leaders keep in touch through radios and rebels in western Afghanistan said there is no regular contact between them and fellow querrillas in the east.

Most of the guerrillas in western Afghanistan are peasants from the area in which they fight. In campfire conversations they repeatedly cited as their reason for takin up arms the threat that Soviet-influenced leaders are trying to steer Afghanistan away from Islamic traditions.

"Throughout the world the Afghan people are famous for one thing, their patriotism," said the former chemistry teacher. "And this patriotism stems from Islam because they know that if they lose their country they will lose Islam."

The fighting has taken a heavy toll in disruption among the villages of Farah Province. Guerrilla leaders and Iranian authorities say more than 100,000 Afghans have fled across the border to escape. A half-dozen communities of dome-roofed mud huts were seen standing empty during a drive to the rebel field headquarters.

The largest, Jijeh Surai, sprawled across a valley irrigated by a river passing through hills that used to be known for their watermelton an cucumbers and through orchards known for their pomegranates.

Some 1,000 homes lay empty and forlorn. The only sound was the plaintive meow of an abandoned cat. The orchards were overgrown and the fields fallow. A cream pickup truck lay crippled on the outskirts, where rebels said it had been hit by artillery fire from a Soviet tank.