Peru ended 12 years of authoritarian military rule and established a freely elected democratic government today as Fernando Belaunde Terry was sworn in as his country's 102nd president.

Belaunde accepted the presidential sash from the president of the newly reconstituted Senate, Oscar Thelles Montes, after Peru's outgoing military president, Gen. Francisco Morales Bermudez, refused to attend the ceremony.

In his inaugural address, Belaunde promised to respect the country's new constitution, work to strengthen democracy, create on independent judiciary, observe human rights, spur economic development and restore freedom of the press.

Belaunde, a 67-year-old architect, referred several times during his speech today to the fact that he was bein inaugurated for the second time, a reminder that he was overthrown by the Peruvian military in 1968 near the end of a presidential term that began with his election in 1963.

The United States was represented at Belaunde's first inaugural by then vice president Lydon B. Johnson. Today, Rosalynn Carter, who was singled out twice for special recognition by the new president, led the U.S. delegation. The ceremony was also witnessed by representatives of 82 other countries, including the presidents of Colombia, Venezula and Costa Rica, two members of Nicaragua's junta and Spain's prime minister, Adolf Suarez.

Communist and other leftist members of the new Congress were generally not enthusiastic about Belaunde's inaugural address, and an estimated 500 leftist demonstrators marched peacefully within a few blocks of the Congress building as Belaunde was being sworn in. They accused the new president of being procapitalist and pro-American and promised to give him no respite during his first weeks and months in office.

Nonetheless, Belaunde won an ample 45 percent of the votes in May's elections and, in coalition with a small right-wing party, has a majority in both houses of Congress. Apra, Peru's second-largest political party, also has promised to work constructively with the new government although its leaders declined to join in the coalition that Belaunde offered after his resounding victory over 14 other candidates.

Most of Belaunde's inaugural address was concerned with economic issues and his plans to improve the country's internal economy by building roads and houses, offering incentives for increased agricultural production, developing Peru's largely untapped hydroelectric resources, seeking foreign investment, especially in the important mining and petroleum sectors, and fighting inflation.

Among other points, Belaunde said that new contracts negotiated by the outgoing military government with two U.S. oil companies, Occidental Petroleum and Belco, were "prejudicial" to Peru's interest and would be "revised."

Petroleum provides the country with more than $1 billion a year in export earnings. Without new finds, however, experts here say that Peru could become a net importer by 1984. Belaunde said the existing contracts must be changed to attract capital and expertise for new exploration.

The new president also announced that Peru's newspapers and television stations, taken over by the military government, would be returned to their former owners as a guarantee of freedom of the press.

Peru's return to democracy is viewed as a higly important example for the rest of Latin America by the Carter administration and by the region's other democracies: Colombia, Venezuela, Costa Rica, Mexico, Ecuador and the Dominican Republic. The United States already has a large aid program here, and other countries, such as oil-rich Venezuela, may also offer assistance to the new government.