More than 3,500 students received degrees yesterday at commencement exercises at the University of Maryland at College Park, while 3,200 went through graduation ceremonies at Johns Hopkins University in Baltimore.

At College Park, Maryland's largest university campus, J. Carter Brown, director of the National Gallery of Art, told graduates and their families that intellectual freedom and civil rights are being threatened by efforts to rein in the National Endowment for the Arts.

"If it starts with exhibitions, when does it get into books, libraries and the whole content of our intellectual life?" Brown asked the graduates gathered in Cole Field House yesterday morning. "Whether or not the government reduction of funding to foster the arts and humanities is technically censorship, the net effect has to be that. It reminds us of Nazi Germany in the 1930s."

Brown urged the graduates to write to members of Congress, which is reconsidering the NEA's finances, to express support for the endowment.

The university awarded Brown an honorary degree during the 90-minute ceremony, along with Samuel LeFrak, an alumnus and New York builder, and Roald Hoffmann, winner of the 1981 Nobel Prize in chemistry.

Meanwhile, at Johns Hopkins, Steven Muller led his 18th commencement as the university's president and his last before resigning at the end of next month. Under a large, white tent on Keyser Quadrangle, graduates listened to Sol M. Linowitz, former ambassador to the Organization of American States.

In the afternoon, Garry Trudeau, author of the Doonesbury comic strip who also was awarded an honorary degree, spoke on campus about the value of "impertinent questions."

"Life, when we pay attention to it, often reminds us that an unexpected or inconvenient truth is the price of honest inquiry . . . . Whether revered or reviled in their lifetimes, history's movers framed their questions in ways that were entirely disrespectful of conventional wisdom," Trudeau told graduating seniors in the schools of arts and sciences and engineering.

He also told them that "if there is one development on American campuses that alarms your elders more than all others, it is a growing acceptance of intolerance."

In addition to Linowitz and Trudeau, Johns Hopkins awarded honorary degrees to seven others, including Lady Bird Johnson and Douglass Cater, president of Washington College in Chestertown, Md.

Commencements also were held yesterday at Prince George's Community College and the Takoma Park and Germantown campuses of Montgomery College. Students at Montgomery College's Rockville campus are scheduled to graduate this morning.