The Ethiopian government has sent written messages to President Carter and several congressional leaders testing the new U.S. military tie to Somalia, its traditional enemy, as "a dagger poised at the heart of Ethiopia."

The messages, which resulted from "an emergency meeting" of the Ethiopian council of ministers Aug. 30, have generated new concern among some of those in Congress and the Washington bureaucracy with strong doubts about the recent U.S. deal with Somalia.

Rep. Stephen J. Solarz (D-N.Y.), chairman of the Africa subcommittee of the House Foreign Affairs Committee, one of the recipients of the messages from Addis Alaba, said Ethiopia's declaration "illustrates the potential problem which can be created for us if we proceed in running the risk of involving ourselves in a regional conflict between Ethiopia and Somalia which could escalate to a larger war." Solarz and six other subcommittee members expressed opposition last week to the U.S.-Somali agreement on grounds it could embroil the United States in an African war.

The State Department, which confirmed that President Carter received a message from Ethiopia's chief of state, Mengistu Haile Mariam, had no formal comment on the contents. But a State Department official confirmed that the message to Carter was "essentially the same" as those transmitted by the State from Ethiopian Foreign Minister Gedle-Giorgis Felleke to House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.), Sularz, and Sen. George McGovern (D-S.D.), chairman of the Africa subcommittee of the Senate Foreign Relations Committee.

The United States and Somalia signed agreements Aug. 22 under which Somalia agreed to provide the United States access to military facilities in its country. In return, the United States agreed to provide Somalia $40 million in military sales credits this year, and the same amount plus $5 million in budgetary support next year. American use of the Soviet-built air and naval base at Berbera and other facilities is part of the Carter administration's military buildup around the oil-rich Persian Gulf.

Somalia is the traditional enemy of Ethiopia, and the Somalis have laid claim to the Somali-speaking region of the Ogaden which lies across the internationally recognized border in Ethiopia. The two countries have fought one another on many occasions in the past. Following the 1977 Somali invasion of Ethiopia, the Soviet Union and Cuba sent military forces to back Ethiopia. A few hundred Soviet troops and 12,000 to 13,000 Cuban military personnel remain, according to U.S. estimates.

The Ethiopian message to members of Congress charged that "the military alliance between the United States and Somalia is not only a direct threat to the security and territorial integrity of socialist Ethiopia, but also an escalation of tension in the region . . . The assault position which the combined forces of Somalia and the United States have taken poses a very grave danger to the survival of Ethiopia as an independent nation."

The message further charged that "Somolia has been pursuing a policy of territorial aggrandizement which is the root cause of repeated wars and tension in our region" and that a Somali invasion of Ethiopian territory "is still continuing at this very moment."

The State Department, while acknowledging that major Somali regular forces were fighting in Ethiopia this summer, maintains that all or nearly all these troops have been recently withdrawn. But the Central Intelligence Agency is reported to have told the Solarz subcommittee last week that elements of three Somali battalions plus up to 1,000 other Somali regulars appear to still be in Ethiopia.

The Ethiopian message said that the Carter Administration's "active collaboration" with Somalia is "fraught with gravely dangerous consequences," but the message failed to spell out what Ethiopia or its allies would do.