Charan Singh resigned yesterday afternoon just 24 days as India's fifth prime minister when supporters of Indira Gandhi withdrew their support.

The collapse of the government for the second time in five weeks left India's president, N. Sanjiva Reddy, with the choice of either calling new elections or allowing Jagjivan Ram, leader of the country's 100 million untouchables, to try to form a new coalition.

Singh, 77, resigned yesterday after the Gandhi bloc's withdrawal of support made it clear he could not muster the votes needed to win a confidence vote in Parliament scheduled for later in the day.

He asked Reddy to call for new elections, which would leave him as head of a caretaker government and possible give him a slight edge in the balloting.

But new politicians in India save Gandhi want elections at this time. Gandhi's personal popularity came through in a recent poll that showed almost half of those questioned preferred her as prime minister and 68 percent said the country was better off under her government.

There is a chance, however, that Gandhi will throw her support to Ram, whose resignation from her cabinet led to the formation of the coalition Janata Party that defeated her in the last election 2 1/2 years ago.

The main issue in that election was the excesses of her almost two years of authoritarian "emergency rule" in which she jailed nearly 700 opposition leaders and imposed a strict press censorship.

In his resignation statement, Singh accused Gandhi of pulling back her 75-member parliamentary bloc because he refused to submit to "blackmail" from her.

He said Gandhi's followers demanded that he stop prosecution in special courts of her and her son, Sanjay, in return for their support. Gandhi has denied trying to pressure Singh, who was jailed by her and once said she should be publicly whipped for her actions during the emergency.

"Some things are more valuable than a mere prime ministership," said Singh in his resignation statement.

"We had no choice but to reject support from quarters which sought interference in the normal functioning of the judiciary. I would not have liked to continue in power even for a day yielding to this kind of blackmail."

Singh became prime minister after engineering mass defections from the government of Morarji Desai, who took over in 1977 when Gandhi was defeated. But Singh depended on the Gandhi votes to amass his parliamentary majority.

Desai, 83, who last month wanted a chance to try again to form a working coalition, decided to withdraw from politics.

In a statement yesterday, Desai said that Ram, who at 72 is the youngest of the politicians trying to be prime minister should be given a chance to form a new government.

Ram, who let Singh and Deai battle it out last month in the first go-round to form the government appeared confident last night that he could pull together "an absolute majority."

He starts with a base of about 225 votes from the Janata Party that he took over from Desai -- still the largest group in the lower house.

Observers here said he will easily get support from about 25 members of regional parties and could gain another 25 votes from members who would do anything to thwart Gandhi.

That would put him either very close to or just over more than the 270 votes needed to win a bare majority in the 539-member lower house of the parliament.

Reuters reported from New Delhi that the parliamentary leader of Gandhi's party told President Reddy that Ram should be allowed to form the government.

Observers here said that Singh, whose power base is among the small landlords and farmers of North India and who only joined the national political scene two years ago, was out of his depth in the hurly-burly of vote trading in New Delhi.

Ram, though, has served in all of India's cabinets with but a one-year break since the country gained independence in 1946.

He was the defense minister in the Desai government, and as such is believed by some American diplomats to be the most hawkish of the Indian political leaders. But other diplomats here think he will moderate those views if he becomes prime minister and has a broader constituency than the military establishment.

If he is given the bid to form the new government, Ram's biggest problem will be what to do about the Hindi nationalist, 100-member Jan Sangh faction in his Janata coalition.

He must depend on it for his majority, but the faction's strong push to make Hindi the national language has angered political leaders representing religious minorities in India.

According to Reuter, Ram will not have the support of the Gandhi bloc if he includes Jan Sangh members in his cabinet. But that would mean the exclusion of such prominent leaders as Atal Bihari Vajpayee, the former foreign minister who is considered a comer in Indian politics and a future candidate for prime minister.

According to observers here, Ram would like to become prime minister without the votes from the Gandhi bloc.

Although many politicians wrote Gandhi off as a political force as recently as two months ago, she has emerged from this crisis as the person who wields enough power to either make or break a government.