The cancer sufferer, in her sixties, has been left mentally incapable of making decisions about her treatment because of the illness, doctors told Mr Justice Hayden.
However, during the period when she was still capable of making decisions, she had said she would not want to live with cancer, he heard.
Doctors told the judge there was a 50 per cent chance the woman, who cannot be named for legal reasons, would be cured if she had chemotherapy.
They also thought the treatment would allow her to regain the mental capacity to make decisions.
Mr Justice Hayden concluded she should have chemotherapy, but if she regained the mental capacity to make decisions she would be free to decide against it.
The judge analysed the case at a London hearing in the Court of Protection, where issues relating to people who may not have the mental capacity to make decisions are considered.
He said Imperial College Healthcare NHS Trust, based near Paddington, in London, had responsibility for the woman's care and had asked him to decide whether she should have chemotherapy.
Mr Justice Hayden heard evidence from doctors and from one of the woman’s adult children.
The judge said there was no doubt she would benefit from treatment, but the question was whether she would want it.
He said people are entitled to make decisions which are not in their best interests.
He said the balance of evidence showed that, if well and able to make decisions, the woman would have wanted to live, but the decision was not easy.
“What I have got to think about is what she would have wanted herself,” he said.
“There is a lot of evidence here that [she] would not want to live with cancer.
“I want to be very, very careful not to impose beneficial paternalism on a person in her position.”
Press Association contributed to this report