Two little-known party figures have emerged as leading candidates for the Japanese premiership following the death early today of Prime Minister Masayoshi Ohira.

Political analysts said Yasuhiro Nakasone and Toshio Komoto, who have both held ministerial posts and offices in the Liberal Democratic Party, are the most likely to reach the finals of what may be another factional struggle in the longtime ruling party.

Ohira's death, many think, may mark the end of an era, opening the door for candidates such as Nakasone and Komoto, who played only supporting roles to senior politicians like Ohira during the 1970s.

There was also speculation, however, that Ohira's death may have helped the Liberal Democratic Party face up, with a united front, to the selection of a new prime minister. There was a chorus of pleas for party unity among politicians and their business supporters who said they hoped his death would serve to heal many old party wounds.

The Cabinet resigned today, in accordance with constitutional requirement, just hours after Ohira, who had been hospitalized two weeks with coronary problems, died of a heart attack at age 70.

His death came just 10 days before Japan is to hold parliamentary elections June 22, following defeat of Ohira's government in a vote of confidence last month.

The nation spent the day mourning his death and reviewing his life in television programs. His official funeral will be held after the elections. A private service for Ohira, who was a Christian will be held Saturday.

Nakasone, 61, and Komoto, 68, had been campaigning for the premiership long before Ohira was hospitalized and both ambitious men, the contest this year is likely to be their last opportunity to lead Japan.

A true gauge of their strength will not emerge until after the crucial elections on June 22, however. Some experts throught a younger dark horse might have a shot this time, and there was also speculation that a compromise caretaker premier might be chosen to mind the government until December.

Ohira's party colleagues, caught by his death in midcampaign, lowered flags to half-staff at their headquarters and suggested that a final fitting testimonial to him should be a party victory in the elections. "The only thing to do is get a victory in the election," declared Nakasone.

All four of the men who dominated the business-oriented Liberal Democratic Party in the past decade now appear to have been eliminated for one reason or another. They were Ohira and former Prime Ministers Takeo Fukuda, Takeo Muki, and Kakuei Tanaka.

Tanaka is on trial in the Lockheed scandal and Miki is regarded as too old. Fukuda might still be eligible but not many people were mentioning his name as a likely successor.

Komoto will probably be the choice of the more powerful business leaders, whose support he has courted. He also represents the Miki faction, which has had a reputation for reformism since the Lockheed scandal scarred the party in the mid-1970s. The president of a shipping company, he has headed the powerful Ministry of trade and Industry and was chairman of a party policy research council.

Nakasone also headed the trade ministry and has held two powerful party posts as secretary-general and executive council chairman. He is regarded as a hawk on defense issues, but that role is more popular these days than in the past.

His major drawback is a reputation among part members for opportunism and he has picked up the uncomplimentary nickname of "weather vane" as one who watches carefully which way the political winds are blowing.

If the party turns in the end to a dark horse, it is likely to be Kiichi Miyazawa, who has been both foreign minister and director-general of the Economic Planning Agency. He could benefit from a growing sentiment among many party members that the Libera Democrats should be headed at the top by younger men.

Assuming the party manages to maintain a clear majority in the lower house elections on June 22, its choice of a party president later would be assured of being selected as prime minister when the house reconvenes.

In the past few years, elections have been accompanied by bruising factional struggles that have nearly torn the party apart, much to the dismay of business interests who supply it with large sums of money in return for a favorable treatment of private enterprise.

The last struggle became so intense that hostilities lingered until mid-May when anti-Ohira, groups boycotted a lower house session, causing Ohira to lose a no-confidence vote and making the new elections necessary before the party really wanted them.

Some analysts said today they believe the Liberal Democratic Party may settle things temporarily by choosing a caretaker premier shortly after the June 22 voting and allowing him to serve until the party's regular convention in December.

Two party elders mentioned most often for the caretaker role are Elichi Nishimura, 82, the party's vice president, and Kokichi Nadao, 79, speaker of the lower house.