The Supreme Court yesterday ruled unconstitutional a New York State law banning the sale of nonprescription contraceptives to persons under 16.

In a far-reaching decison, the court held that the right or privacy as it related to decisions on sexual relations "extends to minors as well as adults."

The justices also struck down two provisions in the New York law that unlike the under-16 are similar to those in the laws of numerous other states.

One invalidated provision prohibits anyone but a licensed pharmacist from distributing non-medical, non-prescriptions contraceptive products - condoms, foam and jelly. Eighteen states, including Virginia, and the District of Columbia, impose a similar prohibition.

The second invalidated provision made it an offense for anyone - including a liecensed pharmacist - to advertise or display contraceptives. Twenty states in addition to New York have similar laws.

Seven of the nine justices voted to overturn the New York law, but aligned themselves variously on key issues in the case. The decision affirmed a panel of three federal appelate judges that had nullified that law.

Justice William J. Brennan Jr. wrote the opinion for the court.Chief Justice Warren E. Burger dissented without comment. Justice William H. Rehnquist dissented with an invocation of the memory of "those who valiantly but vainly defensed the heights of Bunker Hill in 1775" and of those "brave men on both sides" who shed blood "at Shiloh, Gettysburg, and Cold Harbor."

Such men, Rehnquist contended, would be outraged that the court has "enshrined in the Constitution the right the commercial vendors of contraceptives to peddle them unmarried minors through such means as window displays and vending machines located in the men's room of truck stops . . ."

On the issue of advertising, Justice Brenan wrote for the court that the constitutional guarantee of free speech prevents a state from completely suppressing information about the availability and price of contraceptives.

He said that the First Amendment protection the court gave last year to truthful "commercial speech" about the prices of presciption drugs extends to truthful commercial speech about non-prescription contraceptives.

In other phases of the case, Brennan relied on past decisions concerning marriage, contraception, procreation, abortion, family relationships, child-rearing and education.

Four justices - Potter Stewart, Thurgood Marshall, Harry A. Blackmun and John Paul Stevens - joined Brennan in holding that the right of privacy protects decisions about sexual relations against intrustion by the state unless it has "compelling" interests at stake. A decision whether to beget or bear a child "it is at the very heart" of the constitutionally projected privacy, Brennan said.

Only three justices - Stewart, Marshall and Blackmun - joined Brennan in the phase of the opinion extending to minors the right of privacy as it affects sexual relations. For different reasons, Justice Byron R. White provided the fifth vote.

New York State contended that for bidding the distributions of contraceptives to minors under 16 was permissible as a way to implement legislated policy against sexual intercorse among the young. The state also argued the freely available contraceptives would increase sexual activity among the young and thereby violate the policy.

Brennan wrote that just as the Constitution foreclosed a blanket prohibition on the choice of a minor to get an abortion, so does it foreclose a blanket prohibition on distributing contraceptives to minors. In this regard, he noted an irony: New York permits a girl as young as 14 to marry while forbidding anyone except a physician from giving her a contraceptive until she is 16.

Justice Lewis F. Powell Jr., who concurred in the judgement, said that this amounts to an intrusion on the privacy right s of married females between 14 and 16.

Justice White, in providing the decisive vote for extending the privacy right to minors, said it was enought for him that the state had not shown how a ban on contraceptives for persons under 16 inhibits their sexual activity. Justice Stevens said, "Common sense indicates that many young people will engage in sexual activity regardless of what the New York legislature does . . ."

The court voted 7 to 2 to invalidate the requirement that only licensed pharmacists distribute non-hazardous contraceptives to adults. Brennan wrote that the Constitution protects people from this kind of state instrustion into decisions on childbearing. No protection of health is at stake, he emphasized. The vote to ivalidate the ban on advertising was also 7 to 2.