CARACAS, Venezuela (AP) _ Seven policemen were wounded by rifle fire during running battles Friday with protesting students outside the Central University of Venezuela in Caracas, officials reported.

Interior Minister Jose Angel Ciliberto said in a statement that two of the seven officers were in ''extremely grave condition'' after being shot by ''hooded professional agitators who attacked with rifle fire.''

Police said the gunfire had come from inside the campus, but they did not believe students were responsible.

Students at the university's school of pharmacy had called for the demonstration, which began with a peaceful march, to protest the fatal shooting Thursday of an engineering student in the city of Trujillo, 250 miles west of Caracas, during a demonstration.

Student leaders said police killed the student, who was shot in the stomach at close range. The government denied the claim.

There were conflicting reports on the number of students injured during Friday's fighting.

Bernardo Ansidey, president of the Federation of Student Centers, told The Associated Press that about 40 students were injured by birdshot and tear-gas canisters fired by police.

Dr. Nerio Valarino, one of the doctors treating the students, said between 25 and 30 were slightly injured. ''Most of them have been released and the others should be released shortly,'' he said.

Police said 17 demonstrators were arrested. The Venpres news agency quoted authorities as saying another 17 people were detained after police found arms, drugs, leftist pamphlets and gasoline bombs in a Caracas polytechnic institute.

Directors of the Luis Caballero Mejias Polytechnic Institute announced Friday afternoon that the school has been closed indefinitely.

Earlier Friday, the military took control of Trujillo and two other western cities where protests were held Thursday - Merida and Valera.

Students angered by the engineering student's death had set fire Thursday to the Trujillo headquarters of the governing party, Democratic Action.

Thursday's demonstrations were in support of 38 students across the nation who had been on a month-long hunger strike to gain the release of nine students jailed on subversion charges following student riots in April.

The hunger strike was called off late Thursday after Ciliberto agreed to release most of the nine.

The spring disturbances began in reaction to the killing of a university student in Merida and the raising of public transportation fares.

On Wednesday, another student was shot to death in Caracas while riding in a mini-bus that passed a student demonstration near a poor neighbohood. The police denied having fired at any time during the demonstration, saying only tear gas had been used.