Dissident Alexander Ginzburg was convicted of anti-Soviet agitation and sentenced to eight years in prison yesterday while the prosecutor of Jewish dissident Anatoly Scharansky demanded that he receive a 15-year sentence for espionage.

Soviet authorities did not seek maximum penalties against the two men, whose trials were heavily followed in the world press and carried out in the face of steadily increasing Western criticism.

However, at a third trial in Vilnius, capital of Soviet Lithuania, Catholic dissident activist Viktoras Petkus was yesterday given the mamimum term of 15 years in prison, labor camp and internal exile on charges of anit-Soviet agitation. The Vilnius trial received little attention in the world press.

"I do not consider myself guilty and I decline to ask for lessening of the sentence," Ginzburg declared before the verdict at the court in Kaluga, about 110 miles south of here.

The eight-year sentence against Ginzburg, who suffers from poor health, was imposed with especially harsh terms under what the Soviets call "special regime," limiting prisoner activities. The judge did, however, spare Ginzburg, 41, an extra three years of internal exile demanded by the prosecution.

Scharansky, who is being tried in Moscow, declared in his closing argument yesterday, according to his brother Leonid, that it was a "hopeless" effort to defend himself.

"My fate has been predetermined," Scharansky, 30, said pointing out that "a year and a half before my trial I was denounced as a traitor in the government newspaper Izvestia."

The prosecuter, however, asked for three years imprisonment and 12 years in a labor camp instead of the maximum death penalty Scharansky faced if convicted on treason charges.

The trials of Ginzburg and Scharansky have brought a storm of protest from Washington. President Carter this week termed the trial of Scharansky, who was accused of spying for the United States, as "an attack on every human being . . . who believes in freedom."

Secretary of State Cyrus Vance, who ended a two-days conference with Soviet Foreign Minister Andrel Gromyko in Geneva, issued the following comment on the sentencing of Ginzburg:

"I am deeply distressed to learn of the heavy sentence meted out to Alexander Ginzburg, a man whose crime appears to have been that he helped others to survive who sought freedom of expression. To the world Mr. Ginzburg has become known as a symbol of selfless courage and dedication to principles. For these qualtities he has the respect of us all. His wellbeing will be our constant concern."

Although he was not given maximum penalty, Ginzburg, who has heart trouble and a stomach disorder, will be spent to a special camp for those sentenced for the second time. It is the worst and harshest form of incarceration here.

The term "special regime" implies life in individual cells except for work time, two visits annually by relatives, no package from outside for the first half of the term and only rare package in the second half but no vitamins or fresh vegatables premitted. Calories provided at such camps are at subsistence levels.

Ginzburg, during the court proceedings Wednesday, fainted in court and was revived with an injection.

Explaining the lesser sentence meted out, the judge said he showed leniency because Ginzburg had aided in the prosecution of Scharansky and another leading Russian dissident figure, Dr. Yuri Orlov.

"The judge was lying," Ginzburg's mother, Ludmilla, 70, declared. "It was an attempt to morally discredit him."

Ginzburg, a friend of exiled novelist Alexander Solzhenitsyn, was co-founder with Orlov of a Moscow group to monitor Soviet compliance with international human rights guarantees in the Helsinki accord signed by the Kremlin in 1975.

His activities in the group, and reports it issued alleging abuse of individual freedoms by the government, formed the basis of the anti-Soviet propaganda charge, for which Orlov was convicted in May.

"As far as the Helsinki group documents are concerned, "Ginzburg told the court, according to his mother, "the facts they state are true and therefore not slanderous."

"He looks nearly dead," his mother said.

"It is a death sentence for Alexander," dissidents here keeping vigil outside the Scharansky trial said. Ginzburg's wife, Arina, who was barred from court two day's ago after accusing a prosecution witness of lying, said her husband has aged so during his 18 months in jail before trial "he looks like a 60-year-old."

His dark hair has turned gray, she said. The time in jail counts toward the prison sentence.

Ginzburg also was accused of anti-Soviet activities because he administered a relief fund for political prisoners set up by Solzhenitsyn.

Following the Kaluga trials, as Ginzburg was hauled away in a police van, his friends threw flowers on the vehicle and shouted, "Alex, Alex!" Government supporters milling around the courthouse, meanwhile, jeered, "Not enough! Shoot them all!"

At the Scharansky trial, also in its fourth day, prosecutor Pyotr Solonin, said he asked for three years imprisonment and 12 years in a labor camp instead of the death penalty for treasn because of Scharansky's age and no prior convictions.

A court official said Solonin asserted that Scharansky "has been indicted not for his views, convictions and frame of wind, but for concrete illegal actions, spying and other criminal acts."

Scharansky, charged with espionage and anti-Soviet agitation, spoke for about 30 minutes in his own defense, his brother Leonid reported. He said he acted from a desire to improve emigration conditions for Soviet Jews, and recounted czarist repression of Jews, how Jews sought "assassination" in the new Soviet government that took power in 1918 but found roadblocks and Stalinist repression, especially in 1948-52, when many Jews then trying to leave were imprisoned.

Jewish emigration is not a blow against Russia, he asserted. "I know that many people accept the culture of the country in which they live. That is not surprising. Despite this, Jews retain a nation in themselves."

"Is it a provocation of American secret service" that 150,000 Soviet Jews have emigrated in the past eight years? he asked. "It is a natural historic process. Didn't the Jews are looking for the right way - not assimilation with the Soviet state, but in unity, in Jewishness. That is the natural ground on which my activities were held."

Scharansky, who dismissed his court-appointed attroney, Silva Dubrovskaya on Monday, said the allegations by his principal accuser, Dr Sanya Lipavsky, were falsely based on hearsay because Lipavsky was not present at most of the alleged criminal activities.

Lipavsky, a physician who treated dissidents and has turned out to be both a GB informer and a onetime "volunteer" for the CIA, last year in Izvestia denouced Scharansky and other Jewish activiists as part of a spy conspiracy with U.S. diplomats and reporters to betray Soviet defense secrets to America.

The official trial briefing quoted the prosecutor as saying the Scharansky case "vividly" shows how capitalist countries "are stepping up attempts to undermine socialism from within . . . camouflaging them by "defense of human rights" and other humanistic slogans. Life once again confirms that people who betray their motherland in theiminds become paid accomplices of foreign special services."