Gaidar Aliyev, a career officer of the KGB security police who was elevated to the ruling Politburo only two days ago, was named today the first deputy premier of the Soviet Union.

The Supreme Soviet (parliament) elected Aliyev unanimously. It took no action to fill the post of president, left vacant by Leonid Brezhnev's death. Observers believed Brezhnev's successor, former KGB chief Yuri Andropov, had the support to gain the title along with his position as Communist Party General Secretary but declined it at this time because its functions are largely ceremonial and time-consuming.

With two senior KGB officials now in top Kremlin positions, the security service was given additional exposure today as the new KGB chief, Vitaly Fedorchuk, participated in a debate in the Supreme Soviet on a new bill on border security.

The 59-year-old Aliyev's elevation came amid clear indications that he was being groomed for the top governmental post held by Premier Nikolai Tikhonov, 77, and foreshadows a new emphasis on internal discipline. Andropov has quickly consolidated his authority and seems determined to focus on the country's domestic problems.

Aliyev, an ethnic Azerbaijani who joined the KGB at age 19 and spent the next 41 years with the agency, is one of the most attractive and forceful personalities in the Kremlin leadership. Western diplomats who met him earlier this year described Aliyev as an exceptionally intelligent and self-confident man and a "natural politician."

When Andropov took over the KGB chairmanship in 1967, he appointed Aliyev as chief of the KGB in Soviet Azerbaijan. Aliyev held the post for two years before he was named the Azerbaijani party leader to clear out the corruption and economic crime for which the Transcaucasian republic had become notorious.

Although not an economist, Aliyev achieved considerable success in running the economy of Azerbaijan. The republic's industry and agriculture have reported the highest growth rates in the Soviet Union during the past decade.

His selection as the first deputy premier seems to reflect Andropov's intentions to have Aliyev do the same on the national scale.

Andropov, 68, was elected yesterday to the 38-member collective state presidency and thus acquired the right to act as head of state when and if he chooses to do so.

The titular head of state at the moment is Vasily Kuznetsov, 81, a career diplomat who was made an alternate member of the Politburo and first deputy president in 1977 to assist the ailing Brezhnev in the performance of numerous ceremonial functions.

The new prominence of KGB officials was highlighted by the appearance of Fedorchuk, also a career KGB officer, at the two-day, semiannual meeting of the Supreme Soviet. He took part in the debate on a new bill on the Soviet frontiers and predictably talked about increased subversion from the West and the need to toughen up security along the borders. Soviet border guards are a part of the KGB and are believed to number about 300,000 troops.

The text of the new law on Soviet frontiers was not available but diplomatic observers here believe it was put forward at this time in connection with a possible ajdustment along the Sino-Soviet border.

Georgy Kornienko, the first deputy foreign minister who also spoke during this afternoon's session, made a reference to this by saying that there was calm along the Sino-Soviet border at this time and that the Kremlin would like it to become "a border of friendship."

At the height of Sino-Soviet tensions, the two countries conducted a war along their border on the Ussuri river in 1969. There have been sporadic minor incidents along the border in later years.

The two countries have recently begun "political contacts" to normalize relations. One of the key Chinese demands on Moscow has been the withdrawal of large Soviet troop concentrations from the border, and it is possible that the two sides may be moving toward reducing their respective forces along the heavily militarized frontier.

Today's closing session of the Supreme Soviet predictably approved without a dissenting vote the government's budget for 1983 and its plan for the year.

The debate this afternoon gave no additional details as to either the budget or the plan for 1983, leaving diplomatic analysts at a loss in trying to figure out the real state of the economy.

Among its final acts, the Supreme Soviet elected Konstantin Chernenko, the closest aide of Brezhnev and Andropov's chief rival for the post of general secretary, chairman of the foreign relations committee of one of the chambers, the House of the Union. The position was once held by Mikhail Suslov, the party's chief ideologist, who died in January.

The election of Chernenko to the position which has no significance in the Kremlin power structure nevertheless reflected Andropov's apparent desire to hold together the leadership and was interpreted by diplomats as a conciliatory gesture toward his rival.