The Rev. Jesse L. Jackson had gone to Spingarn High School yesterday to congratulate the school's champion basketball team. But a week of reading about drugs and death in Washington had given him a more urgent mission.

"If you experiment with drugs, or are on them now, I want you to come forward," Jackson told the hushed crowd.

Hesitantly, a few students rose. Then a few more, and a few more, until about 100 students were walking to the front of the auditorium, to the cheers and applause of teachers and about 800 fellow students.

Jackson came to the front of the stage, microphone in hand, and praised those who had come forward. He told them they would not be punished or humiliated for admitting they used drugs.

"We can't ask people to stop making money selling drugs, we've got to change our minds," Jackson said, as the students filed quietly from the auditorium toward the principal's office.

"I want Spingarn to be the first school in the country to face the problem," Jackson told the students at the Northeast Washington high school. "I want Spingarn to be number one in wiping out drugs and drug dealers."

He later invited the students who had come forward to go with him to other D.C. schools to help combat drug abuse by teen-agers.

Spingarn Principal Clemmie Strayhorn said he hadn't expected Jackson's gesture, but called it timely in light of the city's recent drug problems, including a rash of heroin overdoses that claimed nine lives.

Strayhorn guaranteed that the students who came forward would not be penalized, adding that officials had not yet decided on a way to help them.

"It was totally impromptu," Strayhorn said. "I didn't know he was going to do that. We have to face the fact that there is a problem and we have to do something about it, and I'm certainly not going to penalize students who are asking for help."

"What he had to say was inspiring to the whole student body," said Ranaldo Baldwin, 18, a Spingarn senior.

Of his fellow students who had acknowledged their drug use, Baldwin said, "I think a lot of them will change their minds about the drugs and start coming back to school regularly ."

"What he said was very encouraging, and gave us a lot of hope," said Ronda Williams, 19, "and that's what we need."

During his speech, which lasted nearly two hours, Jackson reminded students of the recent overdose deaths. "Remember," he said, "this is the same city where young men and women are being carried out in sheets with tags on their toes, dead because of heroin."

Jackson recalled his arrest Monday for joining the daily apartheid protest outside the South African embassy, and the night he spent in the D.C. Jail, along with his two sons who also were arrested in the protest.

"As we stayed in the jail, I talked to about 21 men, some of them in jail three or four months waiting trial," Jackson told the Spingarn students.

"Invariably, none of them had a father at home or a dream, and most of them were trapped selling or using drugs. Our jails are filled with young men putting dope in their veins instead of hope in their brains."

Spingarn's basketball team, which recently won the city championship with a victory over DeMatha High School, has been invited by President Reagan to visit the White House today, and Jackson, a 1984 contender for the Democratic presidential nomination, encouraged team members to ask Reagan about cutbacks in student aid and government scholarships.

"You all better make sense over at that White House tomorrow," Jackson said, pointing to the members of the basketball team seated in the front row. "I want you to ask him why should you honor us for being number one in basketball, but cut scholarships for fellow students in math and science and chemistry."

Jackson also asked students who were eligible to vote but had not yet registered to come to the front of the auditorium.

"I want you to leave here with a diploma in one hand symbolizing knowledge and wisdom, and a voter's card in the other hand symbolizing power and responsibility," he said.