THE SOVIETS, both in their Afghan encampments and back home in the Kremlin, were surprised by the bitterness they provoked when they marched into Afghanistan last December -- at least as surprised as Jimmy Carter says he was when they did so. Why are the Soviets in Afghanistan?

From all available evidence, the Soviets came to Afghanistan not to conduct a Marxist revolution but to stop one -- or, more precisely, to postpone it for a number of years. The real Marxist zealots came to power in Kabul in April 1978. The Soviets helped them do it because the opportunity was there and because it is more desirable to have puppets on a nation's border than truly neutral countries. At the time, Afghan Communists represented 1 or 2 percent of Afghanistan's population.

A strong argument certainly exists for radical change in Afghanistan. The per capita gross national product is about $150 a year. To say simply that this figure places Afghanistan among the poorest countries in the world is misleading. In most of the other $150-a-year economies the weather is warm and one can live comfortably on relatively little. Last year, the purchase of a $55 million DC10 tripled the country's usual trade with the United States. Normally, the bulk of the $20 million worth of American imports consists of used clothing, which one sees piled high in the bazaars. The Salvation Army is the Brooks Brothers of Afghanistan.

Health conditions are appalling. In the countryside, almost anywhere you look, you are likely to see people squatting and spreading their robes. Excrement may make good fertilizer, but it also gets into the drinking water. Everywhere, people of all ages are wheezing and coughing up phlegm. Noses drip. Much of the year it is too cold to bathe regularly, and few people do. Half the children of Afghanistan die before they reach the age of 5.

"I know a family and they had 11 kids and they all died," a Western-educated doctor told me. "They died of respiratory and gastrointestinal infections, all of which could have been cured or prevented. You need a dependable clean water supply that the people will use and rely on. Seal the wells with concrete so the manure doesn't fall into them," the doctor suggested. The country hasn't a single sanitary sewerage disposal system, one United Nations official says. In Kabul and other cities, open sewers follow the sidewalks.

Incredibly little has been accomplished in Afghanistan, even though for 30 years the world's two greatest powers supposedly tried to outdo each other in impressing the country with their aid capabilities. The most visible results are roads and airports (some American, some Soviet), which have recently been used for the Russian invasion and conquest.

The literacy rate is estimated at 10 percent, perhaps the world's lowest, and that means the ability to read a simple signboard, not the works of Kierkegaard. At a conservative minimun, 80 percent of the people live off the food they grow and the animals they raise.

Poverty and ill health are at the roots of the upheaval that has been going on in the country for the past two years. Yet the Communists don't seem to have addressed these problems directly. I asked Shanawaz Shanwany, the governor of Kandahar province, one of the largest in the country, what he thought his government's number one problem was. "No problems," he replied. "We are all happy." Then he reconsidered, and acknowledged that he does have a problem -- resisting the imperialists who occassionally cross the border from Pakistan (Shanawaz, 38, a former army officer and party stalwart, had just become governor of his third province in the past year. He confessed to me that he had no idea of its population, its principal exports, or how many of its people were affected by the country's tumultuous land reform program last year. His appointment, like all important decisions in the country, came from the party's revolutionary committee in Kabul, a tightly knit, little-known group.)

Rather than attack poverty, ill-health and illiteracy head-on, the original Marxist zealots spent their 20 months in power trying to restricture the country's social system quickly and radically. This was done through a series of decrees, three of which were very important. Decree No. 6 freed all farmers from mortgages and other debts to private landowners. Decree No. 7 declared equal rights for women; the most talked about practical aspect of this was abolition of the bride price, by which fathers "sold" their daughters to husbands-to-be, usually for 80,000 to 100,000 afghanis (about $2,000 to $2,500).

Decree No. 8 was the land reform program. Land holdings were limited to approximately 30 to 60 acres, depending on the kind of land; for choice orchard land, the limit was 5 acres. (The measure of land in Afghanistan is the jereeb, either a little more or a little less than half an acre, depending on whom you ask.) The confiscated land was to be distributed to tenant farmers in lots of approximately 5 acres (less for good land). Ironically, in light of decree No. 7, decree No. 8 parceled out these lots mostly to males over 18, the rare exception being female heads of households. If all this weren't controversial enough, many households were ordered to move to land hundreds of miles away from where their families had lived for generations, to regions of the country dominated by other tribes that spoke other dialects. Much of this relocation was apparently politically inspired, aimed at breaking up groups of potential dissidents.

The decrees didn't attempt to change national politics, since Afghanistan had no national policies on basic matters. Afghanistan isn't even a nation -- a fact that the Kremlin may be counting on. The country has long been inhabited by many tribes that jealously guard their independence. It contains, among other groups, approximately half of two major tribal nations, the Pashtuns (sometimes called Pathans) and the Buluchs. The remaining Pashtun and Baluch lands are in Pakistan, having been conquered by 19th century British armies which then attempted to complete the conquest of Baluchistan and Pashtunistan by marching to Kabul, but were twice routed. o

What now passes for an Afghan nation was largely the creation of one chieftain, Abdur Rahman Khan. Before his death in 1901, Abdur Rahman mananged to defeat many of his rival chiefs in battle and to persuade Russia on one frontier and Britain on the other to recognize his territory as a loosely defined buffer zone between their own expanding empires. Addur Rahman's eldest son peacefully succeeded him as head of state in 1901, the last time such a thing has happened in Afghanistan. The son, Habibullah, was eventually shot to death, as have been five of his successors. (The other four have fled.)

The Communists, with their social reform decrees, have received the same reception other emissaries to Kabul have received: obstinance and violence. The bride price is still accepted practice; the bride's father normally holds the money as a kind of prepaid alimony with which to care for his daughter if the husband runs off. Women are being given equal rights only very slowly. A few women will venture out in public, and some even doff the traditional chador, a head-to-toe veil with a gauze screen over the eyes so the wearer can see where she's going. Young teenagers as well as older women wear this attire. I have chatted with the young in their homes, where they were wearing ordinary clothing, yet I would not have dared approach them on the street when they were in chadors.

The attempted land reform, however, brought doom to the Marxists. The government says that from 250,000 to 300,000 families received land, though probably far fewer actually experienced a change, and that not one farmer ever thought to sell his inefficient 5-acre plot, for which he often couldn't get seed or fertilizer. Thus, the government says, no need exists for a law governing whether the grants can be sold.

I never stumbled on a village in Afghanistan where land reform had been carried out. In Pakistan I did encounter Afghan landlords and villagers who had crossed the mountains as refugees because Migs and helicopter gunships had attacked their villages after land reform was resisted. h

Many Afghans do indeed farm as tenants paying landlords a third to half of what they grow, depending on the crop. But this certainly isn't a country of large South American-style plantations run by an ostentatiously wealthy upper class. Many landlords hold recognized places in the tribal or religious structure. Tenant farmers do need a way to secure their own land, but landlords have never been the object of anything like the hatred now extended to the land reformers.

Typical was my visit to a village about 10 miles from Herat. To get there, I, with two villagers who worked in the city and an outsider who came along to help interpret, had to hopscotch puddles down a muddy path and climb over mud walls. In the vallage, a couple of dozen farmers and some donkeys crowded around us. None of the farmers owned his own land; they said they worked for landlords who lived in town (the largest of whom owned about 50 acres). They were plainly a downtrodden group, yet they angrily shouted that they would kill anyone from the government who attempted to enforce the decrees. They produced their mullah. Black-bearded, his turban slightly cleaner than the others', he obviously spoke for the masses when he announced in a strident voice, "I want to tell to the Russian people, they don't come to my country. If the Russian people don't come here, I have no business with them. If they do, I fight them to the last drop of blood."

What changed after the Russian invasion last December was that no one came to such villages. Contrary to expectations, the aerial bombardments that had chased hundreds of thousands of rebellious Afghans from their homes didn't intensify; they stopped. The Soviets dug into huge encampments near important airfields and seldom left; for a while they ventured into the bazaars, but after many were jumped and murdered by angry Afghan civilians, they stayed away. Only in Kabul did Russians patrol city streets, and there only at night, during civilian curfew. Afghan government officials stuck to the cities and main roads. Officially, the bride price remained illegal, but no one was around to enforce it. The land reform program, which caused government to get involved actively in daily life, was effectively called off. (Officially, "Phase 1" had been declared successfully completed, and "Phase 2" wasn't ready to be announced; when, or if, it was, it apparently would be limited to the distribution of seed and fertilizer.)

One result of the land reform disaster has been a big shortfall of wheat. The main staple of most Afghan diets is a delicious thin brown wheat bread called nan, baked in the shape of a snowshoe. United Nations and various diplomatic sources say that 1979 wheat production in Afghanistan was down by some 600,000 tons from 1978 production of 3.2 million tons.

Officially, the government dealt with the shortfall by denying that it happened. As a practical matter, the government imported wheat from the Soviet Union, which the Soviets in turn had imported from the United States. For a while last year the price soared, causing real hardship, but it was brought back to normal, apparently by big Soviet subsidies.

This year the Soviet-picked government still showed no sign of recognizing or dealing with health and sanitation problems. In the wake of the land reform debacle, Fateh Muhammad Tarin, the deputy minister of planning, said that Afghanistan's economic priority was industrialization; the country has extremely little industry now. Plans were being made for plants to make fertilizer and silos, and to process cottonseed oil.

Tarin also talked of building an oil refinery. Afghanistan has enough oil and gas to make most authorities think it could be self-sufficient in energy, though it now produces only 10 percent of its oil needs. Natural gas is the country's chief export (fruit and nuts are second); most of the gas goes to the Soviet Union, in return for heavily subsidized gasoline, which sells on the street in Kabul for about 76 cents a gallon equivalent, one of the lowest prices in the world.

Few Afghans have cars. The fuel most depend on for heating and cooking is wood, and the price of wood about doubled during 1979, largely because of rebel activity in the wood-harvesting areas. For all retailers of products whose purchase can be postponed, such as pots and pans, business is merely bad; for those in the tourist industry, such as hotel and restaurant operators, business is practically nonexistent.

So is banking, despite government protestations to the contrary. One young party member I met, who had just been thrown into management of the main bank in Jalalabad (a large provincial capital near Kabul), insisted that $100,000 equivalent loans were no problem for him. Business was booming. "How much do you want?" he said. The interest was only 12 percent. In two hours there, though, I failed to see a single customer except for currency exchange.

A Western diplomat economist said the ratio of bank accounts to cash in Afghanistan has fallen to 1.05 to 1, meaning the economy is practically 100 percent cash. Shopkeepers were complaining that not even cash was around. "When the new regime came, it dried up," said one in Kandahar. "Some people buy gold." Yet the same shopkeeper and many others I talked to were sending hundreds of dollars each -- all they could scrape together every few months -- to help support the guerrillas in the hills and in Pakistan and Iran. Each town bazaar had a well-organized system for collecting and smuggling out the contributions, sometimes by arranging trade credits in business done with cooperative Pakistani and Iranian merchants.

So the Soviets went into Afghanistan to try to make it a more peaceful place by stopping the revolution that touched off the rebellion. The one revolutionary reform they left intact is the teaching of Marxism-Leninism rather than Islam in the schools, and even there I was told of at least one instance where a radical teacher was replaced with a more moderate one after parents began boycotting the school.

Obviously the Soviets intended to give a longer leash to the incorrigible older generation, expecting them to quiet down and die off, while hoping that today's tots, 30 years or so from now, might be more amenable to becoming the Afghan Soviet Socialist Republic. This is similar to what was done in the Uzbek SSR, the Tadzhik SSR and other lands of Central Asia that border Afghanistan and were very much like it. Had the Soviets not come down, the whole movement toward Afghan communism might have been destroyed.

In the first months after the invasion, however, things were not working out as planned. The opposition clearly was not just a bunch of grizzled old tribesmen; it was practically everybody in Afghanistan. And although Pakistan was too intimidated and Iran too distracted to supply any appreciable aid, and no one else was in a position to do so, the rebels kept fighting. They had no weapons capable of resisting the Soviet's tanks, armored personnel carriers, airplanes and helicopters, but an unescorted carload of Soviet or Afghan government officials still couldn't travel 50 miles on any road in the country and count on arriving safely.

If the Afghan rebels can obtain arms with the help of the countries directly affected and threatened by the Soviet action, the USSR could be in trouble. It could be thrown on the defensive over issues such as Baluchistan, and might ultimately even retreat from Afghanistan. For several decades the Soviets have sought to befriend the Third World; now, in one sweep, they have lost a lot of that friendship. The Kremlin can doubtless take Afghanistan and even Baluchistan with tanks, but its sights are set on preeminence in other regions, too, and, like any war machine, the Soviets' will appear weaker the farther it get from its own borders.