MOSCOW (AP) _ Russia soon will announce diplomatic recognition of the breakaway Yugoslav republics of Croatia and Slovenia, a news agency reported Wednesday.

Russia has been one of the closest allies of Yugoslavia's federal government, whose troops fought bitterly for six months in Croatia in an attempt to stop its secession.

The fighting generally has stopped since a U.N.-mediated cease-fire took effect Jan. 3, and the European Community and other nations have recognized Croatia and Slovenia as independent states.

The independent Interfax news agency said a Russian Foreign Ministry envoy, Yuri Deryabin, traveled to Serbia, Croatia and Slovenia earlier this month to explain Russia's decision.

''By the time we made this decision, as many as 42 states had announced their recognition of Croatia and Slovenia,'' Deryabin was quoted as saying by Interfax.

Deryabin stressed that Russia intended to maintain contacts on the federal level and develop bilateral relations with Serbia, Yugoslavia's largest republic, Interfax said.

Russia also is looking forward to developing economic relations with Croatia and Slovenia, notably in the fields of ship construction, pharmaceuticals and machine-building, Interfax said.