Turkey's conservative coalition government collapsed today following months of Cabinet indecision that had hampered the country's foreign relations, almost bankrupted the economy and caused more than 100 political deaths.

Defectors from Prime Minister Suleiman Demirel's Justice Party teamed up with the opposition to topple the four-month-old three-party coalition in a New Year's Eve vote of no confidence.

A total of 228 members of the 450-seat National Assembly voted against the government, two more than the necessary 226-vote absolute majority needed to unseat it.

Demirel, 52, who has ruled Turkey for nine of the past 12 years, immediately handed in his resignation to President Fahri Koruturk, saying: "Governments come and governments go, but we must greet this with peace."

Bulent Ecevit, leader of the leftist Republican People's Party and Demirel's most likely successor, also appealed for national unity and calm.

But in Balikesir in western Turkey a student was wounded by gunfire, an apartment house was blasted by a bomb, and police clashed with protesting rightist youths. In Ankara, the slaying of a student last night brought to 109 the total of political deaths since Demirel last came to power in August.

Failure of the coalition to maintain law and order, halt economic decline and agree on major foreign policy issues caused its support to dwindle at home and its credibility to wane abroad. The coalition was made up of Demirel's rightist Justice Party, the fervently Moslem National Salvation Party and the neo-fascist National Action Party.

After Demirel's party suffered a major setback in nationwide municipal elections Dec. 11, a dozen assemblymen resigned from the Justice Party, charging that it was more interested in staying in power than solving the nation's ills.

The defections wiped out the coalition's slim parliamentary majority and sealed its downfall. But Demirel faces possible charges of corruption once out of office, refused to resign, forcing the opposition to bring him down in the no-confidence vote.

Although the 12 Justice Party defectors voted with the opposition to topple Demirel, it is not certain they will support Ecevit, whose party is the largest but still a minority in Parliament.

Their recent statements indicate that they favor a "grand" coalition of the Justice and Republican People's parties, but both Ecevit and Demirel oppose this.

Ecevit, 52, tried unsuccessfully to form a minority government following national elections in June. He also failed in 1974 to rule in partnership with the National Salvation Party. Cooperation with the National Action Party, which is linked to much of the recent political violence, also seems unlikely.

Ecevit is therefore expected to try to persuade the Justice Party defectors plus half-a-dozen independents and splinter party assemblymen to give him the necessary votes to rule alone.

Most Turks, including the military, would prefer a strong, single-party government capable of acting to solve national and international problems rather than another period of indecisive coalition rule.

Ecevit, a Harvard-educated poet-journalist, is also favored by foreign diplomats here as the best man to disentangle Turkey's foreign problems, notably Cyprus.

Ecevit was the premier in 1974 who ordered the Turkish invasion of Cyprus following a Greek-led coup aimed at uniting the island with Greece. He is therefore in a stronger position, the diplomats argue, to make concessions on Cyprus leading to a solution of the problem, improvement of relations with Greece and the United States and strengthening of NATO's weakened southeast flank.

Despite his leftist leanings, Ecevit is committed to Turkey's continued participation in NATO and strong ties with the West, including membership in the European Common Market.

The Demirel government had sought to make up for deteriorating relations with the Common Market and United States through closer ties with neighboring Arab states and the Soviet Union.