As India's former prime minister Indira Gandhi sat in a prison cell last week her supporters managed to turn an unexpected opportunity into a dark cloud over her political future.

Gandhi last week was a candidate for political martyrdom. The ruling Janata Party had expelled her from Parliament and jailed her for the remainder of the session after convicting her of contempt of the house and breach of privilege.

From her personal point of view, the sentence was more boring thandamaging. The session had only a few days to run. Her time behind bars-in the same jail where she kept some political opponents during her emergency-was limited. She was allowed books, visits from her daughter-in-law and meals sent from home.

Even her expulsion from the house was harmless. It meant only that, if she wanted to resume her seat, she must run again in the by-election at Chikmagalur, where she won decisively on Nov. 5 this year. Politically, this is no hardship. Chikmagalur is part of Gandhi's southern Indian stronghold and the massive by-election publicity will be welcome.

So as a political gift from the Janata, the expulsion and imprisonment seemed to be pure gold. That, however, was last week, when public sympathy was swinging behind Gandhi, fogging memory of her misdeeds during the emergency and making Janata seem unneccessarily harsh.

What snatched away her opportunity was the later behavior of her supporters, the unleashing of terrorist violence and the reemergence as a force of her son, Sanjay.

Nineteen persons died in the violence that followed Gandhi's arrest, including seven who burned to death when a mob set a bus ablaze. A freight train was burned, bombs went off and rioters damaged buildings and property in many parts of the country.

Supporters of Gandhi's Congress (Indira) Party courted arrest and more than 120,000 arrests is impressive, but India is full of impressive statistics. The population rises by a million every month, for example. Or this: One million persons are estimated to have been forcibly sterillized during the 19 months of Gandhi's emergency rule.

What needs to be looked at is the overall picture in India, to see the extent to which the demonstrations and violence reflected spontaneous feelings rather than organized actions by pro-Gandhi militants.

To the Congress (Indira) Party called for strikes. But it got a poor public response, demonstrating that Gandhi does not have the backing of the people to immobilize the country. Most places carried on as normal. It was also notable that students were conspicuously absent from most street demonstrations.

The most bizarre incident during the campaign was the hijacking of an Indian Airlines jetliner by two men who claimed to have pistols and a hand grenade. No one was hurt and the hijackers surrendered after night-long negotiations with the authorities. But in some ways this incident may have done Gandhi mor political damage than even the burning of bus passengers because out of it came the name Sanjay Gandhi.

To millions of Indians, Sanjay Gandhi is a bogeyman who talked his mother into overturning democracy and declaring the state of emergency, Some criminal prosecutions are still pending against Sanjay.

Yet he remains in control of the Indira Youth Congress-the body that engineered most of the latest disturbances and is reported to have placed his own men in key positions within the party itself.

When the two young men who hijacked the Indian Airlines jet wee negotiation with the authorities, they gave Sanjay Gandhi's telephone number and asked that a message be passed to him. They indicated they were working under his orders. For his part, Sanjay simply admitted knowing both men. Police are investigationg.

Whatever the truth, after 20 months out of the political limelight, Sanjay Gandhi is once more the center of attention and the memories of many Indians about he excesses of the emergency have been revived.

But for his mother, there is still a spark of hope, and it is provided by internal wranglings within the Janata Party itself.

For months, senior party members have been trying to reconcile Prime Minister Morarji Desai and the former home minister, Charan Singh. They have failed, however, to persuade Desai to take Singh back into the Cabinet. And there is every indication that he is preparing to break away and form his own party.

On Saturday, Singh celebrated his 77th birthday by calling a rally in New Delhi to demonstrate his support. The most conservative estimate put the number of his supporters at 300,000, although the Delhi police said there were up to 600,000, many bused in from nearby farm areas where Singh has much of his following.

Singh told the rally he had been expelled from the government because"I cannot tolerate any kind of dishonesty or corruption in public life." He said he would convene a meeting of his political allies next month.

For Janata, most ominous of all was a gift-a massive bouquet of flowers-handed to Singh during the rally. The card wished him "many, many joyous years." It was signed: "Indira Gandhi."