NEW DELHI, AUG. 14 -- At the stroke of midnight tonight India marks 40 years of independence, but it does so as a nation hesitant to acknowledge the achievements of its past because of the uncertainties of its present.

India's emergence from colonialism was the first of the great 20th century nationalist movements, as this fractious nation marched to freedom behind the frail body of Mahatma Gandhi, the eloquence of Jawaharlal Nehru and the political missionaries of the Congress Party.

When Nehru's grandson, Prime Minister Rajiv Gandhi, returns to the Mogul-era Red Fort of Delhi Saturday morning, the white, green and saffron tricolor that flies there will mark four decades of democratic rule, of a boisterous press, of an economy striving against stupendous odds and of an Army that has been the model servant of civilian rule.

It is a record virtually unequaled in the political and economic wreckage that characterizes much of the political landscape in the developing world that attained independence in the global shakedown following World War II.

Yet, India's celebrations are tentative at best. Despite the country's proud accomplishments over the past four decades, a new generation of political leadership under the younger Gandhi has inherited a nation still overwhelmed by rampant poverty and violent warfare between rival ethnic and religious groups.

The pomp and rhetoric may be elaborate, but the speakers stand behind bulletproof shields, as uncertain for their lives as they are for their political foundations. These uncertainties only mirror doubts and cynicism that have set in among their fellow countrymen, from the elite of New Delhi to the old freedom fighter in Bombay to the peasant in Haryana state.

Political scientist and commentator Rajni Kothari began a series of anniversary articles in the Hindustan Times with a sobering assessment of the state of the nation.

"As the nation prepares to celebrate 40 years of independence, the picture of India that is emerging cannot please the heart of anyone," Kothari wrote.

"From whichever angle one looks, the country is in the grip of a series of intensifying polarizations -- between the rich and the poor, between government and the people, between the so-called majority community {the Hindus} and the minorities, between the urban elite and the rural masses."

Kothari's view of 1987 is far from the vision of Mohandas K. (Mahatma) Gandhi when he told the Congress Party in 1936, a decade before independence:

"Let there be no mistake of my conception of swaraj {self-rule}. It is complete independence of alien control and complete economic independence. So at one end you have political independence and at the other economic."

There was an idealistic faith inherent in the enthusiasm of Mahatma Gandhi and his fellow campaigners for independence. Not only would independence bring freedom, but also the political and economic riches that colonialism suppressed.

What has happened to Gandhi's vision in the 40 years since Britain pulled down its colonial flag, leaving behind a divided South Asian empire that began its independent existence in a bloody migration of Moslems to Pakistan and Hindus and Sikhs to India?

When the British pulled out of India, the 300 million people they left behind received a legacy of a railroad, a civil service, some grand government buildings, a disciplined Army and a crushing burden of poverty that almost two centuries of western colonial rule had done little or nothing to alleviate.

Virtually every disease known to man was endemic. Education beyond a privileged elite was limited. Any industry that existed was structured to fill the coffers of the colonial power, while Britain's industry provided goods for India's millions.

Forty years has changed much of that. Diseases like malaria, tuberculosis and cholera exist but no longer are epidemic. Smallpox has been eliminated. Life expectancy that was barely over 30 years at independence now is in the mid-50s.

Literacy, which was 16.67 percent according to the 1951 census more than doubled to 36.2 percent by the 1981 census. More than 90 percent of the children between 6 and 11 now are in some kind of school, double the percentage at the time of independence. For higher grades, the percentages quadruple.

Economically, a country that witnessed a famine that killed tens of thousands five years before independence now can export grain if the monsoon rains are kind. Its economy has grown 200-fold in the four decades of independence and produces Indian-made automobiles, computers, nuclear facilities and a growing variety of consumer goods.

While the economies of other countries have grown faster, India at least has managed its growth without incurring the huge debts that burden so many developing nations. Its debt service ratio (the amount needed to pay off debt compared to production and income) in 1985 was 1.4 percent of its gross national product and 12.7 percent of exports. Brazil, another major power in the developing world but one carrying an enormous debt burden, must devote 4.9 percent of GNP and 34.8 percent of exports to pay off its massive loans.

For all the gains, however, India remains crushingly poor.

In the World Bank's annual report for 1987, India ranks 17th lowest of 119 countries in gross national product at $270 per capita. Compare that to $720 for Honduras, $800 for Thailand, $2,130 for Argentina and $16,690 for the United States.

Planning commission officials estimate that a staggering 271 million people in 1983 had incomes below the official poverty line of $120 per year. The statistics institute, using a different method of calculation, put the number at 313 million.

Life expectancy may have almost doubled in four decades, but citizens of more than 70 countries have a longer life span. For all the gains in literacy, almost two-thirds of the population is illiterate.

All this is far from Mahatma Gandhi's idea of successful economic independence, and much of it can be attributed to soaring population growth.

All the gains in agriculture, industry, literacy and health are undercut by one basic fact: India's population has almost tripled in its 40 years of independence and is not expected to level off until it passes 1 billion in another two decades.

For all these problems, India has resisted the disease of totalitarianism that was present at the creation of many independent states or crept in later on the barrel of a soldier's gun.

India's politics have been governed by the ballot and its social values by rule of law. Each has been strained, especially the police and court system, but neither has been broken.

Yet, there are those who question how long this country's democracy, and its unity, can hold out as its increasing population creates pressures that seem to have no other outlet than violence and corruption.

The theme of the Hindustan Times anniversary series is decline of institutions: of parliament, police, courts, leadership.

Kothari, in his article, pointed to the decline of political leadership as the most critical problem.

"The professional party politician is proving to be so impotent in dealing with problems and is, in consequence, withdrawing into such narrow, self-seeking and self-preserving methods of conducting public affairs that he is fast losing not just credibility but relevance," Kothari wrote.

"Forty years ago when we entered our 'tryst with destiny' we undertook an essentially political journey in which the party system and the party politician were to occupy center stage . . . The alternative was to hand over reins of power to a colonial bureaucracy, a law and order machinery and the armed forces . . . Today we feel we are being let down by this very class of our countrymen."

In practical terms this perceived political decline is measured in increasing numbers of Hindu-Moslem clashes, in the violence of Punjab, in inter-caste conflict and in the myriad failures of promises of economic and social fulfillment.

If Kothari expressed the frustration in the language of the political analyst, some of the old freedom fighters showed even more embitterment in reflecting on the gap between the idealistic expectations of 40 years ago and the realities of slow and difficult progress.

Standing on the fringes of an anniversary meeting in Bombay addressed by Prime Minister Gandhi, Shyam Kochrekar, 60, told a reporter for The Statesman, "If we had known that this is what India would be, we would not have made the sacrifices we did."