The United States signed an agreement with the Tanzanian government today providing for the return of the Peace Corps to Tanzania 10 years after it was angrily thrown out.

The Tanzanian decision to allow the volunteer corps to resume its activities here is widely regarded in U.S. diplomatic circles here as the clearest indication yet of the vast improvement in relations between the two countries since the Carter administration took office two years ago.

The Peace Corps was summarily ousted in November 1969 at a low point in American-Tanzanian relations amid local press charges that its mostly English-teaching volunteers were "spies" working for the Central Intelligence Agency.

Under the accord signed here the Peace Corps will begin by sending 54 specialists in fish farming and reforestation. They are scheduled to arrive this summer. At its peak in 1965, the Peace Corps program here numbered 411 Americans.

The agreement was signed by U.S. Ambassador James W. Spain and Tanzanian Manpower Minister Abel Mwanga. R. Sargent Shriver Jr., the Peace Corps' first director, in Tanzania with his family on a private visit, was an invited guest for the signing.

Tanzanian President Julius Nyerere reportedly first broached the idea of the Peace Corps returning here in discussions with Ambassador Spain about six months ago.

Sam Brown, director of ACTION, which administers the Peace Corps, described Nyerere, in a statement issued in Washington yesterday, as "one of the most progressive and respected leaders in the Third World." Tanzania's acceptance of the Peace Corps, Brown said, is "another indication that President Carter's foreign policy is restoring America's credibility in the Third World."

Nyerere is understood to believe relations between his country and the United States have improved sufficiently to justify having the Peace Corps present once again despite the opposition to its return in some Tanzanian government leftist circles.

For this reason, it is expected the corps will keep a low profile for some time.

Both sides seem to regard the gesture as primarily a political one since the number of volunteers scheduled to come here is far too small to make any appreciable impact on Tanzania's economic development.

The agreement on the Peace Corps follows another recently signed one involving the U.S. Agency for International Development. That agreement is for a $10 million regional planning project in the rich coffeegrowing region of Arusha in northern Tanzania.

Under this expanded economic assistance program for Tanzania, AID is to take overall responsibility for carrying out a rural development plan for the entire district. It will include setting up 50 agricultural extension service centers, improving farm production, developing 276 miles of secondary roads and 200 miles of feeder roads, introducing new farming techniques and training village leaders in better management procedures.

The agency has been working in Arusha district with Masai nomads since 1970 and is on the point of finishing a 350-mile all weather dirt road through Maailand as part of its drought relief assistance program in the region.

Altogether, U.S. economic assistance to Tanzania is running at between $20 million and $30 million annually -- only a medium-sized program compared to many others here.

The AID program has come under attack from some quarters in the U.S. Congress because Tanzania is a dedicated socialist, although non-Marxist, African country. But AID officials here defend it on the ground that it is fulfilling the key congressional mandate of getting aid directly to the rural poor.

Despite difficulties in absorbing $300 million to $500 million in foreign assistance each year, Tanzania generally gets high credit from all donor countries for directing the thrust of its development efforts toward the countryside rather than the cities. It is widely regarded as one of the few African countries to have done so successfully on a major scale.

Still, it is a remarkable development that socialist Tanzania would entrust capitalist-oriented United States with the task of drawing up a development plan for one of its 22 regions.

Another recent indication of Nyerere's desire to work more closely with Washington has been his persistent support for the Anglo-American peace proposals for Rhodesia. While other frontline African presidents have been losing faith or interest in them, the Tanzanian leader is still pushing for their implementation.