Ms Lawson, 53, said she took cocaine with her late husband John Diamond when he found out he had terminal cancer, and in July 2010 when she was being "subjected to intimate terrorism by Mr (Charles) Saatchi" (from whom she recently divorced).
She said: "I have never been a drug addict. I've never been a habitual user. There are two times in my life when I have used cocaine."
Ms Lawson was giving evidence at Isleworth Crown Court, London, in the trial of her former personal assistants, Elisabetta Grillo, 41, sometimes referred to as Lisa, and her sister Francesca, 35. The jury has heard that the sisters, both of London, used credit cards loaned to them by Ms Lawson and Charles Saatchi to spend more than £685,000 on themselves.
The celebrity cook had faced dozens of photographers and television crews from around the world as she arrived at the court to go in the witness box.
Speaking about the claims she had taken cocaine, Ms Lawson told the court the first time she had taken it was when her late husband Mr Diamond found out his cancer was terminal, and she had it with him on six occasions.
Speaking about the second time in her life, she said it was when a friend gave the drug to her.
"There was another time I took cocaine. In July 2010 I was having a very very difficult time.
"I felt subjected to intimate terrorism by Mr Saatchi," she said. She added that she felt "isolated and in fear of ... just unhappy".
"A friend of mine offered me some cocaine. I took it," she said.
Ms Lawson said it "completely spooked" her.
She said: "The idea that I am a drug addict or habitual user of cocaine is absolutely ridiculous."
Ms Lawson said Mr Saatchi "told everyone" he was taking cocaine out of her nose after photographs appeared in newspapers of him holding her neck at Scott's restaurant. She claimed the incident was actually sparked when she commented on a person walking by with a baby.
Ms Lawson told the court. "I said, 'I'm so looking forward to having grandchildren'. He grabbed me by the throat and said, 'I'm the only person you should be concerned with'."
Ms Lawson also admitted taking cannabis in the last year of her marriage to Mr Saatchi.
"I have to be honest, I have smoked the odd joint," she said.
"I found it made an intolerable situation tolerable. It's a false friend and not a good idea. I found the answer was in changing the situation and trying to create a tolerable situation for me and my family.
"I have to say, since freeing myself from a brilliant but brutal man, I'm now totally cannabis, cocaine, any drug-free."
Ms Lawson claimed she did not know how to roll a cannabis joint but had instead asked others in her house to do so. "This was not behaviour I'm proud of," she said.
Ms Lawson said she was not a "habitual drug user and drug addict, or a snorter of cocaine for 10 years".
Asked by Anthony Metzer, QC, representing Lisa, where these drug claims may have come from, Ms Lawson replied: "I believe some of it came from your clients and Mr Saatchi - not the three most reliable witnesses."
Ms Lawson said Mr Saatchi was unaware she was smoking cannabis and admitted she had not told him she took cocaine once during their marriage. "It was a one-off," she said. "I felt by going to my GP I didn't feel a need to tell him."
Ms Lawson said Lisa was aware she had taken cocaine in the past.
But she said claims that credit cards and envelopes containing white powder were left around the home she shared with Mr Diamond were "completely false".
Ms Lawson said she believes Mr Saatchi had a mindset of "Get her, I don't care what it takes" in relation to her and the current legal proceedings. She told the court he feels betrayed by her.
In reference to Mr Saatchi possibly suing her if she did not appear as a witness in this trial, Ms Lawson said it was "just another form of bullying".
She said he was on a campaign to "ruin me in any way", whether financial or otherwise.
The trial continues.