BONN, Dec. 23— Germany flexed its new diplomatic muscle today by recognizing the independence of two breakaway Yugoslav republics, Slovenia and Croatia.

German consulates in the two republics will be upgraded to embassies on Jan. 15, the Foreign Ministry said in a statement.

"In the view of the German Government, the republics of Slovenia and Croatia fulfill the conditions set by the European Community," the statement said.

At a fractious European Community meeting last week, Germany announced to its partners that it was planning to recognize Slovenia and Croatia, even if it had to do so alone. To preserve a semblance of unity, the 12 member countries approved a resolution authorizing recognition of new nations that meet certain conditions, including stable borders, respect for democracy, and protection of minority rights. Thousands Killed in Fighting

Several European leaders, as well as President Bush and Secretary General Javier Perez de Cuellar of the United Nations, had urged Germany not to proceed with plans to recognize the two republics immediately. They suggested instead that recognition be withheld until it could be granted as part of an overall peace settlement.

Both supporters and opponents of recognition say their position will help end the fighting, which has claimed thousands of lives since since Slovenia and Croatia declared independence this summer. Troops of the Serbian-dominated regular army and militias have taken over a third of Croatia's territory in their attempt to block Croatian secession.

Under the European Community resolution, today was the first day on which a member country could declare that Croatia or Slovenia had met the conditions for recognition. The community set Jan. 15 as the first day for formal recognition, and whether Germany has adhered to that deadline or acted too quickly was described in Bonn as a matter of interpretation.

After the community's decision was announced last week, Chancellor Helmut Kohl hailed it as "a great victory for German foreign policy." He dismissed charges by Yugoslav leaders that Germany was building a sphere of influence that would form the basis of a "Fourth Reich."

"We Germans are concerned about the fate of these people and about their future in democracy -- nothing else," Mr. Kohl said.

Germany has pledged not to send military aid to Croatia, but is ready to begin a quick civilian aid program that will include reconstruction of war-damaged cities.

Chancellor Kohl hopes the recognition will signal to Yugoslavia's Serbian leaders that their country is doomed to break apart, and perhaps persuade them to accept a peace settlement. He argues that unified Germany, a central European nation that is geographically close to the conflict zone and that has itself benefited from the protection of foreign democracies, is in a special position to understand the yearnings of isolated republics. A Gamble by Kohl

Chancellor Kohl's policy is a gamble that diplomatic isolation will force Serbian leaders to accept defeat. If it does not, Germany will be in no position to back up its recognition with force. The Constitution forbids sending German troops abroad, and all political parties oppose the shipment of weapons to crisis regions.

The Munich newspaper Suddeutsche Zeitung, one of whose correspondents was killed this year while covering the Yugoslav conflict, today criticized the Government's action as "an empty gesture" that was "a foreign policy reaction to domestic political pressure."

There are about 700,000 Yugoslav workers in Germany, most of them Croats. Many have deep roots in Germany, and an estimated 200,000 are voting citizens. They have been highly active in demanding that the Bonn Government recognize Croatia.

Germany's haste to recognize Croatia has disturbed some Europeans, for various reasons. Among them is the memory of World War II, when Germany supported a pro-Nazi government in Croatia. -------------------- Bosnia Appeals to U.N.

SARAJEVO, Yugoslavia, Dec. 23 (Special to The New York Times) -- The President of Bosnia and Herzegovina formally appealed to the United Nations Security Council today to deploy peacekeeping forces in this Yugoslav republic as soon as possible to reduce the risk of a serious outbreak of ethnic violence.

"This would secure the peace," said President Alija Izetbegovic, adding that he hoped peacekeeping troops would be stationed throughout the republic but especially along its borders with Croatia and Serbia.

"It would be desirable that they come before Jan. 14," he said.

Photo: Santa Claus bringing gifts to Croatian Art Force soldiers, members of Zagreb theaters who joined the Croatian forces, on Sunday in Karlovac, Yugoslavia. He was guarded by a member of the the force. (Associated Press) Map of Yugoslavia showing location of Slovenia and Croatia