The Soviet Union cautioned Finland today against making "any miscalculation" in the selection of a successor to former president Uhro Kekkonen, saying such errors "could turn out to have consequences that are difficult to anticipate."

In their first substantive comment on the Finnish political situation since Kekkonen's retirement three weeks ago, the Soviets made it plain that they expected his successor to continue the policy of a cordial relationship between the neighboring countries.

While the commentary in the Communist Party newspaper Pravda sought to avoid endorsing a particular candidate, it indicated that the next president should come from Kekkonen's Centrist Party.

Diplomats here said this suggested an indirect endorsement of former foreign minister Ahti Karlajainen, 58, who is cochairman of the Soviet-Finnish trade commission. He is challenged for the party's nomination by parliamentary speaker Johannes Virolainen.

The Centrist Party, Pravda said, "is confronted with the most important decision in its entire history."

Today's long commentary suggested some nervousness here that the burgeoning ties between Finland and the Soviet Union may suffer with the departure of the director of Finland's delicate balancing act.

In some respects, Finland is to Moscow what Hong Kong is to China. Apart from political benefits they get in floating their initiatives and testing Western attitudes there, the Soviets have developed trade with Finland, currently worth more than $5.5 billion annually.

Moreover, Finland has also become Moscow's showcase of how a parliamentary democracy can get along with Moscow. Western critics have frequently described the relationship as one of Finland's subservience to the Soviet Union, using the term "Finlandization" for a partial loss of independence. Most Finns, however, reject such criticism.

Pravda reminded the Finns of the advantages of "Kekkonen's line," which included "secure borders and independent foreign policy" as well as of trade benefits that it said have helped the country escape serious recession.

It made no mention of Premier Mauno Koivisto, the Social Democratic candidate who, according to recent opinion polls, is the favorite in the race for the presidency. The election is scheduled to be held Jan. 17 and 18.

Some diplomats here speculated today that the warning against "miscalculation" may have been directed at Koivisto. However, Koivisto and other leading contenders have all come out in favor of Kekkonen's policy toward Moscow.

Kekkonen, 81, skillfully wove a web of contacts between the two countries, building a special relationship to secure Finland's independence while frequently supporting Soviet foreign policy initiatives. He is the only Western leader to receive the Lenin Peace Prize.

The Soviets, in turn, have accepted the fact that Finland is not a communist country and have given conspicuously little support to Finnish Communists.

Soviet pressure in 1958 brought down the Finnish government and later helped Kekkonen secure the presidency. Since then, the Soviets have shown considerable restraint in dealing with Helsinki. Press comments in the past almost invariably criticized any challenges to Kekkonen's policies.