AMHERST, MASS. -- A six-day occupation of a University of Massachusetts building by minority students ended yesterday after protesters and the school's chancellor agreed on changes to correct alleged racial harassment on campus.

The takeover ended just before 1 p.m. when 150 minority students walked onto the steps of New Africa House and sang a gospel song, then raised their fists in a victory salute.

"We, the Third World students, wish to acknowledge the time and effort of the administration and the support of those on campus and elsewhere in the world," said Dwayne Warren, 22, a senior.

The five-page agreement was worked out late Tuesday between Chancellor Joseph Duffey and nine of the protesters. It includes a promise to change the school's student conduct code to allow suspension of students guilty of racial violence or harassment.

Duffey also promised renovation of the New Africa house, funds for educational and cultural activities for minority students and increased funding for recruitment of minority students and teachers. He rejected a demand for student involvement in hiring faculty members.

Protesters say racial tensions at the university began with a clash between blacks and whites after the 1986 World Series.

Duffey said the negotiations were cordial. "I ordered Chinese food and I hunched over one word processor and they were at another," Duffey said. "They were a very lively, interesting, wonderful group of young people. We had a good time. We also had serious differences."

Asked whether the university environment is racist, Duffey said he believed "racism exists in every part of American society. In this campus it had cropped up and become exposed."