When D.C. Mayor Marion Barry spoke to 2,000 teen-agers yesterday at a Planned Parenthood conference, his first question was: "How many of you know a teen-ager who has gotten pregnant?"

Nearly every hand in the room went up.

"All of you know a friend, a teen who got pregnant?" the incredulous mayor asked, repeating his question.

The same number of hands went up and all the mayor could do was pat his brow and say, "Jesus Christ."

The mayor appeared at the largest conference for teen-agers ever sponsored by Planned Parenthood of Metropolitan Washington.

The one-day conference at the Washington Convention Center was an experiment aimed at spreading the theme, "Say 'No' to pregnancy, Say 'Yes' to your future." That theme echoed through songs, skits, discussions and speeches. There also were exhibits by companies and organizations, most of them offering career information to the teen-agers.

The theme is a slight change from Planned Parenthood's stance of the past. "Planned Parenthood has told teens it's better to wait, but if you choose not to wait, use a contraceptive," said Brenda Rhodes Cooper, director of community services. "Now we're just putting more emphasis on the 'no' because we've discovered that children are having sex younger and younger.

"We're just taking a look at the world as we live in it," Cooper said. "This isn't a complete change. In 1978 we had a brochure entitled 'It's okay to say no way.' "

Few of the teen-agers, all of whom are working as part of the Mayor's Summer Youth Program, appeared to heed the message. Most seemed to view the day as a chance to get off work and enjoy some free entertainment. To hold their attention at the more serious parts of the program, organizers kept reminding them that a go-go band would be performing soon.

But even the music had a message. The audience cheered a performance by the Washington Area Improvisational Teen Theatre Troupe, which had members delivering staccato messages such as, "I love to party. I love to dance. Most of all, I love romance," followed later by, "I played the game. Now I've got to pay the piper. Instead of having fun, I'm changing diapers."

Louise Lucas, a Portsmouth, Va., City Council member and one of the speakers, traced her life from the day she gave birth to her first child at age 13, through becoming the first woman to finish an apprenticeship at the Norfolk Navy Shipyard, to her council election.

Barry cited statistics. "One of every five mothers giving birth in the District is a teen-ager," he said. "Three thousand teen-agers got abortions in the District last year."

The statistics seemed to fly past most of the audience. Then he asked, "How many of you don't know a teen-ager who has been pregnant?"

This time only 12 hands went up.

"I don't think you should do it," the mayor admonished. "I know my telling you won't make you stop. But remember, if you're old enough to do it, you're old enough to take care of it."

Planned Parenthood expected no miracles from the conference. "We hope that we have gotten kids seriously thinking about the fact that it's up to them to prevent teen-age pregnancy," said Cooper. "It's their issue. They have to take the lead."

While most of the teen-agers, when asked, said they enjoyed the day and would come again, they also admitted to being sexually active and having friends who are sexually active.

"Ain't nobody going to stop people from getting pregnant," said Dana Brown, 16.

"No matter what they do, they can't stop people from having babies," intoned her sister, Sheila, 17, who has a 4-month-old daughter.