In a 6-to-3 decision that marked the first time the justices took an extensive look at the controversial issue of pretrial detention, the court reinstated a New York law that had been declared unconstitutional. The ruling leaves undecided whether pretrial detention for adults - an idea favored by the Reagan administration - is permissible.

''Pretrial detention need not be considered punitive merely because a juvenile is subsequently discharged subject to conditions or put on probation,'' Justice William H. Rehnquist wrote in his opinion for the court.

In such cases, Mr. Rehnquist said, the state is acting ''to promote the welfare and development of the child'' as well as to protect society.