A court here is testing, apparently for the first time in the United States, the right of a surrogate mother to back out of one of the increasingly popular baby-by-contract deals.

Denise Lucy Thrane, of Arcadia, Calif., volunteered to bear a child for an infertile New York couple. But after she was artificially inseminated with sperm from the husband, James Noyes, and became pregnant, she changed her mind and decided to keep the baby. Now the Noyeses are in court contesting her right to do that.

Attorneys throughout the country have reported hundreds of childless couples resorting to artificial insemination of surrogate mothers as an alternative to adoption when the wife has been unable to conceive.Other legal issues involving such arrangements, such as the surrogate's right to accept a fee for her services, are already before courts in other states. But the Pasadena case appears to be the first time a surrogate mother has backed out of a deal and been legally challanged.

"She's going to breast-feed that child," said Stanley Springer, attorney for Thrane, described as a widow in her 20s and mother of three, "and they want to wrest it away."

The Noyesses asked Superior Court Judge Robert M. Olson to order blood tests to determine whether Noyes might be the father of the child and to prohibit Thrane from naming the child or its father on the birth certificate. They also want custody of the baby -- due any day -- when it is born. The Noyeses apparently also are asking that the infant be placed in foster care with them allowed visiting rights until the case is decided and to be allowed visiting rights even if they are denied custody.

The exact nature of the contract between Thrane and the Noyeses is uncertain, says Springer. He said the New York couple claim they have Thrane's written permission to take the child but that issue, Springer said, probably would be argued in court.

Lawyers familiar with family law said today it is very unlikely that the Noyesses can win legal rights to the child once it is born, even if there is a signed contract. American and common law give unusual weight to the rights of a natural mother, particularly if she decides to keep the child before any adoption papers are signed.

The Noyeses and their attorney, Noel Keane of Dearborn, Mich., could not be reached for comment today. The Los Angeles Times quoted Mrs. Noyes as saying, "We wish we could tell you what hell she's [thrane] put us through." The Noyeses and Thrane have not met but have spoken on the phone and corresponded.

Judge Olson, acknowledging that he is in a "quandary" over the uncharted legal waters ahead, is uneasy in his role of modern-day Solomon. On Friday, he granted one of the Noyess' requests and ordered that blood tests to determine paternity be done as soon as the child's pediatrician approves. He ruled to allow Thrane to name her baby. But he deferred any decisions on custody and foster care until later.

He said he intends to proceed slowly and to decide the case "in the best interests of the child," although the state legislature and ultimately society will have to contend with the issues it raises. "Unmarried natural fathers now have equal rights as I understand it. But they've always become fathers in the customary way. This fellow became a father in New York. Does society want to treat him the same . . . ?"

Springer said his client was not paid for her services, although her medical expenses were covered. Often the attorney arranging the agreement for the childless couple is paid a substantial fee -- sometimes as much as $20,000 -- but there is no indication of how much Keane has been paid in this case.

Springer said his client had doubts about the arrangement very early. The first artificial insemination attempt last April in New York did not succeed and she reluctantly agreed to try again. But shortly after the second insemination she changed her mind about giving the baby up.

Surrogate mother arrangements have increased because of the very limited supply of adoptable babies in the United States and because of the desire to have a baby that is related to at least the husband of the adopting couple. Kane, the attorney for the Noyeses, has been matching couples and surrogates for several years, including several clients overseas.