Prime Minister Yasuhiro Nakasone said Monday that Japan is far ahead of the United States as a well-educated and "intelligent society" and suggested that the reason for this is the United States' large population of blacks, Puerto Ricans and Mexicans.

Nakasone's words attracted little attention here initially but have been elevated into an important political issue after they provoked an uproar in the United States.

This morning, Nakasone reportedly told Japanese reporters that his remarks were taken out of context. "With such things as the Apollo program and SDI [President Reagan's proposed Strategic Defense Initiative], the American people have accomplished great things," Nakasone reportedly said this morning. "But at the same time, the United States is a multinational society and in some fields, such as education, there are points that they have not reached."

Nakasone reportedly said his words were not meant to convey "racial discrimination or to denounce other countries." Chief Cabinet secretary Masaharu Gotoda told reporters this morning that he understood U.S. officials had told Japan they understood that.

Nakasone's words seem certain to be a major political embarrassment to a man who claims special abilities in understanding and dealing with Japan's allies and trading partners.

Japanese Foreign Ministry officials worked through the night here to put out a clarifying statement. Japanese television today was replaying clips of U.S. evening news program to give viewers a taste of the strength of the U.S. reaction.

Nakasone's original remarks came during a speech to a gathering of junior members of his ruling Liberal Democratic Party. Most of the speech centered on political strategy for the party.

A tape of the speech shows that Nakasone praised Japan as a "high-density, dynamic society" in which a great deal of information is available from such sources as television.

"Japan is now a highly educated and fairly intelligent society," Nakasone said, using English for the words "intelligent society." "Much more so than America, on the average. In America, there are quite a few black people, Puerto Ricans and Mexicans. On the average, it is still very low."

Nakasone said that during feudal days Japan had a 50 percent literacy rate, while in Europe at the time it was only 20 to 30 percent. "In America even now," Nakasone said, "there are many black people who do not know their letters."

Elsewhere in the speech, Nakasone said that he pays attention to the neckties that he wears on television. "When women watch, it seems that they remember the color of my tie but not what I said."

The Foreign Ministry considers that Nakasone's remarks and the way they are reported in the United States could seriously damage relations, an official said. Due to often tense negotiations over trade and Japan's $ 50 billion trade surplus with the United States, Japan is anxious not to give Americans cause for offense in other fields.

[In Washington, the Congressional Black Caucus asked the Japanese Embassy for an immediate clarification of Nakasone's remarks, while Rep. Esteban Torres (D-Calif.), chairman of the Congressional Hispanic Caucus, said that whether Nakasone "was referring to the intelligence level or the literacy level of blacks, Puerto Ricans and Mexicans, . . . either way he should retract the statement."]

That the government is reacting at all seems due primarily to foreign, not domestic, criticism. Japanese newspapers did not consider Nakasone's words a big story. Some of those that carried them put them in light, humorously written "reporter's notebook" columns.

Nakasone's potential embarrassment is compounded by the fact that eight days ago he took the highly unusual step of firing a Cabinet minister for publicly questioning whether Japan was really a blatant aggressor during and before World War II.

The statements triggered angry reactions in China and South Korea. Japan occupied both countries in that period and is today anxious to improve relations with them. Some political analysts say, however, that many Japanese agree with those views on the war, although they rarely express them directly.

Japan is one of the world's most culturally and racially homogenous countries. The largest minority, Koreans, number about 700,000 in a population of 120 million. Many Japanese are proud of this sameness and count it as a strong plus in the country's economic success. Although calls to "internationalize" are heard constantly here, the country is at the same time wary of anything that might dilute its cultural unity.

Most of Japan's prejudices are directed against neighboring ethnic groups, particularly Koreans and Chinese. To the extent that Japanese embrace any foreigners, they have done so with Americans. However, white Americans often get warmer receptions than nonwhites.