President Reagan thanked Italian President Sandro Pertini for the rescue of Brig. Gen. James Dozier from the Red Brigades and arranged for Dozier to be a guest at the state dinner for Pertini last night.

The conservative 71-year-old American president and the 85-year-old Italian socialist showered warm words of praise on each other yesterday as the White House celebrated a high point in U.S. relations with Italy and recognized its increasingly important role in the European alliance with trumpet fanfares, marching troops and a 21-gun salute.

Reagan's Hollywood friend, Frank Sinatra, and Perry Como, another entertainer of Italian descent, performed after the state dinner.

In welcoming Pertini on his first visit to the United States, Reagan focused on the Italian government's battle against terrorism.

"It takes a special kind of strength to face such an adversary while maintaining democratic institutions," Reagan said. "It appears that you are on your way to victory over these cowardly criminals."

Reagan added: "I extend to you now on behalf of all Americans our thanks for everything that was done to free Gen. James Dozier. This triumph over evil has inspired good and decent people everywhere."

In a 90-minute meeting, Reagan praised Italy for its unwavering willingness to accept cruise missiles on its soil, its participation in the peacekeeping force in the Sinai desert between Israel and Egypt and its forthright condemnation of the Soviet Union for the invasion of Afghanistan and imposition of martial law in Poland.

For Pertini, a much-beloved Italian Resistance hero, it was an occasion to reminisce and express gratitude for the American effort in Europe in the two world wars. He spent most of his youth in prisons and in exile in France as he fought first Mussolini and then the Nazis. At one point he stopped by an American flag on a standard and kissed it to demonstrate his feelings about the United States.

But there were also muted expressions of disquiet about elements of current American foreign policy from the Italian delegation. U.S. officials said Foreign Minister Emilio Colombo told Reagan of concern in Italy over U.S. policy in Central America.

The officials added, however, that Colombo indicated that the Italian government supported the Reagan administration's Caribbean Basin initiative and believed that European governments should assist the United States in providing economic aid there.

Pertini went out of his way in remarks prepared for his toast at the dinner last night to underscore the European belief that detente with the Soviets must be kept alive. He also strongly condemned violations of civil and human rights.

As president of Italy, Pertini's role is largely ceremonial although he nominates the prime minister, who runs the government. He also stands as a symbol of continuity in a country that frequently changes governments.

Pertini will fly to San Francisco Saturday and visit Chicago, New York and the United Nations before returning to Italy April 1.