A federal judge ruled yesterday that the University of Maryland did not violate the constitutional rights of Marxist professor Bertell Oilman by rejecting his appointment as a department chairman in 1978 -- a move that generated nationwide publicity.

The ruling in Baltimore by U.S. District Court Judge Alexander Harvey could end Oilman's protracted struggle to gain the chairman of the school's Department of Government and Politics, a position he maintains he was denied because of his political beliefs.

Oilman said he would like to continue the court battle, but that will be up to his attorneys, who would have to find a legal basis for appeal.

Oilman and his supporters have asserted that the case contains broad implications for academic freedom, but a spokesman for the American Association of University Professors said yesterday that Harvey's ruling is unlikely to have "significant impact, positive or negative, on the safeguards for academic freedom at American universities."

The case, however, became a cause celebre in the academic community three years ago when Oilman, a Marxist who teaches political science at New York University, was first offered the chairmanship by University of Maryland officials and then denied the job by incoming President John S. Toll. The proposed appointment had caused a furor on the Maryland political scene, drawing negative comments from legislators, members of the university's governing board and the acting governor.

After Oilman was rejected, he filed a civil lawsuit, seeking $300.000 in damages and aserting that the rejection was based on his political views, rather than his qualifications for the job.

In a ruling issued yesterday, Harvey rejected that contention, stating that Toll's decision was made "honestly and conscientiously . . . for reasons which he believed would promote his goal of improving the standing of the university." Harvey added that even if Toll "were mistaken in his evaluation" of Oilman, the court should not "second-guess" such a decision unless it was based on on unconstitutional grounds, such as Oilman's political beliefs.

Harvey's ruling, which followed a four-week trial and nearly three years of legal preparation, was based heavily on testimony by Toll and two other university officials, all of whom Harvey found to be impressive" witnesses.

From his office in New York City, Oilman said yesterday, "When President Toll rejected me, I said the decision was based on political grounds, and anyone who thought otherwise must also believe in Santa Claus. It seems the University of Maryland has found a conservative judge in Maryland who believes in Santa Claus."