The Spanish governments is seeking to give the impression that growing terrorism in Spain, carried out largely by ethnic Basque revolutionaries, is masterminded by Moscow in an attempt to undercut Madrid's plans to join the North Atlantic Treaty Organization.

Senior aides of Prime Minister Leopoldo Calvo-Sotelo have said in interview in recent days that although Basque separatist violence was a local phenomenon stretching back two decades, they have indications that the Basque guerrilla organization ETA is being manipulated by the Soviet Union. The goal is to destabilize Spain enough that the government's policy announced last month of seeking entry into NATO within two years would be unacceptable to the Atlantic Alliance, the aides said.

The allegations of Soviet involvement and the NATO linkage, independent of their validity, reflect the real concern in political circles here over the fragility of Spain's young democratic system.

By raising the issue of Soviet manipulation, officials here also are able to cast doubts on the genuiness of the Basque guerrillas' alleged freedom fight, appeal for Western understanding and cooperation and depict the problem of terrorism to its own people as being more than just an internal matter.

Calvo-Sotelo hinted at Soviet manipulation in a televised speech Friday at the end of a tense week of political violence that brought renewed indications thhat there could be a rightist military coup to stamp out terrorism and end Spain's experiment with democracy.

"The government believes that terrorism in Spain must be understood not only in its internal context but also in the field of international action where there are underhand[ed] attempts . . . to prevent our country taking its rightful place among free nations," Calvo-Sotelo said.

One aide at the premier's official residence said: "It would be inexact to say that [the Basque gunmen belonging to] ETA are ordered from the other side. They have been shooting for a long time for their own reasons and need no directives. But the present linkage to NATO concerning Moscow is an ongoing assumption here. It is basically a question of coincidences. What ETA wants is also what the Soviet Union wants."

This assessment was echoed by Western diplomatic sources here.

ETA, the initials of Euskadi ta Azkatasuna (Basque Homeland and Liberty) seeks the secession of Spain's ethnic Basque northern provinces and the creation of an independent Basque state.

As Spanish press reports suggesting Soviet involvement in Basque terrorism began to spread this week, the Soviet Embassy in Madrid took the unusual step of denying them in a letter to the conservative Madrid newspaper Ya that was published today. The letter from the embassy press attache said: "The Soviet Union has been and continues to be the enemy of the theoretical principle and the practice of terrorism, including in international relations. . . . Any assertion that the Soviet Union is involved in terrorist activities is pure invention."

Western diplomatic sources noted that there had been consistent pressure from Moscow and its allies to deflect Spain's approach to NATO membership. Cuban President Fidel Castro spoke out against Spanish membership at a summit of non-aligned nations in Havana in 1979 and the issue has been raised since, most recently at the current Conference on Security and Cooperation in Europe meeting in Madrid.

The presence of Basque guerrillas at training camps in Soviet client states, such as South Yemen, has been common knowledge in government and diplomatic circles here for some time. U.S. State Department spokesman Dean Fisher said in Washington yesterday that such training was "a matter of public record."

The apparent eagerness of Spanish officials to tar the Basques with the Soviet brush is interpreted as a response to the escalation of the political violence rather than the uncovering of dramatic evidence. The concern about Basque terorist violence has grown considerably here since the attempted coup in February and the realization that elements in the armed forces are seriously disaffected. A military coup bringing a return to dictatorship would make Spain an unwelcome candidate for NATO entry.

A senior official at the Iterior Ministry said the antiterrorist command, a unit that includes military and police intelligence services, had no doubts as to ETA's international contacts and Eastern European links. "ETA has such contacts and it is careful to maintain them outside Spanish territory," the official said.

Opinion over the Soviet involvement and the NATO linkage hardened both among the Spanish intelligence services and in the prime minister's circle last week when ETA severely injured King Juan Carlos' chief military aide in a bomb blast. The bombing came three days after leftists had killed another general.