The Spanish government, which has pledged to seek entry in NATO, will attend a nonaligned nations' conference for the first time, according to Foreign Minister Marcelino Oreja, who said today Spain would send observers to the conference scheduled to start in Havana later this month.

Oreja announced this new direction in Spanish foreign policy on his return from Latin America. The foreign minister had accompanied Premier Adolfo Suarez on a 10 day tour of Brazil, Ecuador and the Dominican Republic.

Both the prime minister and Oreja have stated repeatedly in speeches to parliament that the ruling Union of the Democratic Center (UCD) government will seek entry to NATO, despite the strong antipathy to the Atlantic alliance indicated by the Socialist and Communist opposition parties. At its national congress in October, the UCD party voted overwhelmingly in favor of entering NATO.

The Havana conference, scheduled to start Aug. 28 with heads of state attending the final sessions during the first week of September, is expected to take a strong anti-U.S. stance.

Observers believe that the original nonaligned policy advocated by Indian Prime Minister Jawaharlal Nehru, Egyptian President Gamal Abdel Nasser and Yugoslavian President Tito toward an increasingly pro-Moscow stand. That, at least, seemed to be the trend at the previous conference in Colombo, Sri Lanka, in 1976. The Havana venue for the September meeting will most probably force a similar line.

Defending the decision to attend the Havana conference, Spanish Foreign Ministry sources said the government had accepted an invitation to the meeting because it wished to be present at discussions concerning the Canary Islands, considered part of Spain; the disputed Western Sahara, a former Spanish colony, and Equatorial Guinea, another former colony where President Francesco Nguema Macias was overthrown by a military coup Aug. 3.

The sources said Oreja or Secretary of State for Foreign Affairs Carlos Robles Piquer may be present at the meeting as invited guests. They stressed that attendance at Havana did not alter the NATO commitment and pointed out that Portugal, a NATO member, attended the Sri Lanka conference and would send a delegation to Havana.

The Foreign Ministry sources added that Spain, scheduled to host the European Peace and Security Conference next year, could gain valuable experience by attending the Havana meeting.

The conservative ABC newspaper reported that the decision to attend the Havana conference, which was apparently raised at a Cabinet meeting before Suarez and Oreja left for Latin America Aug. 4, had sparked dissent within the government. The newspaper suggested it had also distressed Secretary of State Cyrus Vance who met the Spanish delegation in Ecuador, where they were attending the inauguration Friday of President Jaime Roldos.

U.S. diplomatic sources here discounted the reported State Department fears, saying that it was preferable to have friends attending the nonaligned conference. Spain and the United States are bound by a friendship and cooperation treaty, which remains in force until 1981.

Dissent within the Spanish Cabinet was voiced, according to ABC, by the Spanish Minister for Relations with the European Common Market, Leopoldo Calvo Sotelo, a recognized supporter of NATO. CAPTION: Picture, ADOLFO SUAREZ...NATO commitment reiterated