Sarah Smith (41) was caught after she agreed to take the package of tranquilliser tablets into the prison out of "naivety".
Judge David McHugh gave her a three-month suspended sentence.
Smith, with an address at Moreen Avenue, Sandyford, pleaded guilty to smuggling drugs into Wheatfield Prison last March 5.
Blanchardstown District Court heard the accused went to the prison on a visit to her boyfriend at 2.50pm and tried to hand over a drugs package to him.
She was observed by staff and was taken from the visiting area to a side room, where she gave them the package, which contained €20 worth of diazepam.
Smith, who had no previous convictions, was taking the case very seriously, her barrister Jennifer Jackson said.
She was "absolutely petrified" to be in court.
Smith had shown "deep regret and remorse from the moment she was caught", was very cooperative with prison staff and gardaí and made full admissions at the time.
Judge McHugh said it was a serious offence for anyone to attempt to take drugs into prison.
It was "contrary to good order in the prison, put stress on staff and was a danger to the health of those receiving it", he said.
Smith was "fully aware of the gravity of the situation", Ms Jackson said.
She had no experience of the criminal justice system and there was a "bit of naivety" involved.
The accused had been with her boyfriend only since last January.
He had built up a drug debt in prison, and Smith received a threat to her home and her children.
Rather than go to the gardaí, Smith felt this was the best way to deal with the situation, "to protect her children and her home".
She was not going to benefit financially from the crime.
"It's the vulnerable that seem to be the people that are used in this type of situation," Judge McHugh said.
Notwithstanding the mitigation, he said he would impose a sentence, but suspended it for a year.