NEW DELHI -- -- Prime Minister Rajiv Gandhi is attempting a major counterattack to recover from a series of defeats over the past several months that had begun to raise questions whether the Nehru-Gandhi political dynasty was reaching its end.

For months Gandhi has been bludgeoned by electoral defeats, seemingly unsolvable domestic crises, charges of scandal and foreign troubles on every frontier. A series of apparently self-inflicted political wounds exacerbated his problems.

The report card for Gandhi's first thousand days as prime minister of India's almost 800 million people will not elicit much satisfaction from his supporters.

"Rajiv has been saved only by the fact that his foes within the party have no one to put up against him," said one neutral political observer. "To say that he has emerged as the undisputed political leader, however, is far from reality."

Gandhi's closest aides pointed to his party's victory in this week's presidential election and his expulsion of three prominent foes from his Congress Party (I) as evidence that the tide has turned in his favor.

"This has been his ordeal by fire," said one confidant, referring to an important element of Hindu mythology in which Sita, wife of the god Ram, has to prove herself by walking through fire.

"He has been through it and he has emerged as the leader of the government . . . . It is now his opportunity to reshape the party and the government, if he wants to."

This upbeat assessment of the prime minister's fortunes is not universally shared.

Less committed observers say Gandhi's troubles are not behind him. He has major political questions hanging over his head as he approaches a new session of Parliament, and the country faces daunting problems that will bear directly on his and his party's future.

"Rajiv has had three major hurdles to jump in the past couple of months. There was the election in Haryana, in which his party was mercilessly drubbed, and there was the selection of a new president, in which he came close to being directly challenged within the party, but whatever the outcome, both of these are now behind him," said one experienced political analyst.

"But there is a third issue that has not been resolved -- the corruption issue -- and it will be a lightning rod in the next session of Parliament."

{One of Gandhi's supporters, film star Amitabh Bachhan, resigned from Parliament Friday, Reuter reported. Congress Party (I) sources said the actor wished to spare Gandhi embarrassment from unproven opposition charges that he and his brother had channeled funds abroad illegally. Bachhan has denied violating the law.}

While some corruption charges involve close friends of the prime minister, the major one -- a multimillion-dollar contract for long-range artillery from Sweden's Bofors company -- comes straight to the prime minister's door. The contract was negotiated when Gandhi held the defense portfolio as well as the prime ministership.

Despite persistent claims that there were no middlemen or payoffs involved, a recent report by the Swedish audit bureau showed that more than $39 million in "finishing fees" were paid to an unnamed Indian or Indians. So far, Bofors has refused to say who got the money.

"Somebody got a lot of money. Who?" asked one political activist.

"The Indian government has asked Bofors and the Swedish government for the names, but maybe they are not pressing too hard. . . . If Bofors starts naming names in the India case, how many people will start wondering whether they might not do the same thing in some other case in the future and look elsewhere for their weapons?" the activist added.

This has led some observers to speculate that Gandhi might try to face down his opponents during the upcoming session of Parliament in the hope that the corruption issue will subside. In the meantime, he is expected to take a flurry of high-profile political actions that project him as a decisive party leader and try to keep his foes off balance.

All this is a far cry from the atmosphere of promise and the image of a new, modern political age that Gandhi brought with him when he succeeded his assassinated mother, Indira Gandhi, in November 1984. As a former airline pilot only recently initiated into the rough-and-tumble world of Indian politics, he was seen as having a lot to learn. But he assumed office on a wave of sympathy as the son of the assassinated leader and the grandson of Jawaharlal Nehru, founder of the Indian nation.

The "new India" of Rajiv Gandhi quickly became the old India of political back-stabbing, religious and caste hatreds and violence, as well as cynical and corrupt political and business practices. But one legacy of Gandhi's early days in the prime minister's office has saved him: his party's overwhelming victory in the December 1984 parliamentary elections.

It is Gandhi's commanding majority in Parliament that is keeping him in power. His short-term task is keeping control of his party to make sure there will be no election until the normal five-year term expires at the end of 1989. But as Gandhi spends time and energy trying to protect his flanks, major national problems are festering, not to mention longstanding issues of population control and economic development.

Almost 600 people have been killed this year in Punjab and neighboring Haryana as the conflict among the Sikhs becomes wider. The accord with Sikh leaders that Gandhi reached shortly after coming to power, which seemed such a promising sign of his future tenure, has withered away and he will have to start anew in even more difficult circumstances. As of now, the government seems committed only to a hard-line strategy of trying to stamp out terrorism.

Other separatist groups in the sensitive Darjeeling area and in the long-troubled northeastern states continue to press their claims for independence, sometimes violently.

Hindu-Moslem tensions have shown signs of increasing as militants in both groups become more entrenched. The area near the great mosque in Delhi's old walled city has been under curfew often in recent weeks as groups clash every time it is lifted.

These situations strain the nation's cohesion but also present long-term political problems for Gandhi, whose party historically has depended on support from Sikhs and Moslems in crucial states.