Afghan attorneys and judges are visiting the Soviet Union this week to learn how to switch their Western-style legal system to match Moscow's. In Kabul, elementary school teachers have just completed orientation courses on a new curriculum for the first four grades that emphasizes communism.

The Sovietization of Afghan institutions, most of which have their roots in the West, is well under way according to observers here and in New Delhi.

The Soviets, who occupy Afghanistan with more than 85,000 troops, appear to be trying to consolidate their ideological hold on the rugged, nationalistic and stubbornly proud Afghans, who are resisting the Red Army and refusing to accept some of Moscow's offerings, especially scholarships.

"They are in the process of trying to create an Afghan Soviet socialist republic," said the one Islamabad-based analyst of Afghan affairs.

Others, however, reject that notion. In his recent article in Foreign Policy magazine, the experienced South Asia analysts Selig S. Harrison quotes a Soviet source who insisted Afghanistan will become another Mongolia -- a previously independent country that is completely under Soviet domination, although it maintains its status as a nation.

Oddly enough, the institutions that Moscow is trying to change do not reach deeply into Afghan society, which outside a handful of major cities is governed largely by tribal customs.

Nonetheless, Moscow is working hard to convert the legal and educational systems and is trying Afghanistan economically to it and the Soviet Bloc. It also has placed Soviets in key positions in newspapers and the staterun news agency, Bakhtar.

Even United Nations agencies in Kabul, which were dominated by Western technical experts as recently as 1978 when the pro-Marxist government took control in a bloody coup, are composed of a preponderence of Eastern Europeans and Indians. Out of the 65 technical experts working in Afghanistan under U.N. development programs, only three are Western, and the Afghan government has threatened not to renew their contracts.

Perhaps the most crucial changes in Afghan institutions are occurring in the educational and legal systems, which had been based on Western models.

According to Kabul newspapers, the Soviet-installed government of Babrak Karmal is starting in the first four grades of elementary school to transform the education system into the Soviet mold. Last month teachers attended seminars introducing them to the new curriculum and new textbooks.

According to teachers who fled Afghanistan, the new texts carry a heavy dose of Soviet propaganda, emphasizing communist history and communist slogans. But, no copies of the books have yet appeared in the Afghan refugee communities here or in New Delhi.

Higher education also is acquiring a Soviet stamp. For instance, the science academy of the Soviet Union recently signed an agreement to exchange scientific information and train Afghan scientists.

The brightest Afghan students are no longer allowed to accept scholarships to Western universities, according to refugee sources, but instead are forced to go to the Soviet Union.Some students were reported to have refused to accept Soviet scholarships, fleeing into exile.

Other trade and aid programs are being run by the Soviet Union's East Bloc allies. The East Germans, for instance, are running a police advisory program formerly operated by West Germans.

One radio reports a month ago announced that more than 1,000 Afghans would be sent to the Soviet Union for technical training -- including a group that will learn driving skills.

For the youngsters, the Babrak government has set up pioneer youth camps on the Soviet model where 100 7 to 9 year-old students from Herat, Kabul and Kandahar were taught how to protect public property.

"The concept is scary," said one Afghan refugee in New Delhi.

A former prosecutor in the Afghan Ministry of Justice reported that the entire Western-oriented Afghan legal system is being changed to match the Soviets. He said all appeal courts have been abolished and people without legal training, some with eighth grade educations, are being appointed as judges because they have political connections.

During the past week Kabul radio reported that two large delegation of Afghan lawyers and judges traveled to the Soviet Union "to get insight into the Soviet judicial system." Deputy Prime Minister and Justice Minister Rashid Arian told one delegation Feb. 19 that they should use every moment of their trip to learn the Soviet legal techniques.

According to one exile source in New Delhi, the first sign of a deliberate policy of Sovietization in Afghanistan came in the fall when Moscow announced it was stringing electric power lines from the Soviet Union to Afghan cities because it would be too expensive for the Afghan government to set up its own power generating facilities.

Reports are given almost daily of a new Soviet-Afghan trade or aid agreement, further tying the Afghan economy to the Soviet Union.

Last year, according to Kabul radio, trade between the countries totaled $670 million, and in 1981 that amount is expected to leap to $2 billion.

The Soviet Union traditionally has been Afghanistan's largest trading partner, but its influence has not been that great until the Soviet invasion in December 1979 cut off Western access.

The Soviet influence is so dominant now that a trade meeting recently between Soviet and Afghan officials took place in the Soviet Embassy in Kabul.

"This is the first time I have heard that Afghan deputy ministers are going to the Soviet Embassy for discussions," said one former Afghan government official, now a refugee in New Delhi.

The greatest volume of Afghan-Soviet trade is in natural gas, which Afghanistan exports to the Soviet Union at what it insists are international prices. Last year Kabul earned $212 million in gas sales to the Soviets, and the amount is expected to jump considerably in 1981.