Dozens of Hasidic Jews packed together shoulder to shoulder in a Brooklyn courtroom yesterday, seeking leniency for a teenager who forsook his strict upbringing to help run a huge smuggling ring that flooded New York with the drug Ecstasy.

But to their surprise, the 70 members of the Bobover sect found themselves the subject of a scathing lecture by a federal judge who upbraided them in a quavering voice for allowing an international drug smuggling ring to flourish in their midst.

''Where was the community when all of this was going on?'' the judge, I. Leo Glasser, demanded of the crowd gathered in his courtroom in Federal District Court in Brooklyn for the sentencing of the teenager, Shimon Levita, 18. ''Where was the family when 18-year-old boys were traveling from Paris to Amsterdam, Montreal, New York and Atlanta?''

''They were gone for long periods of time,'' Judge Glasser continued as rows of gray-bearded elders and hatted, somber women listened from the gallery. ''They were traveling around Europe. They applied for passports. Where were the teachers? Who was keeping tabs on these boys who were bringing drugs back and taking money there?''