Prison authorities have caught out a 14-year-old boy who tried to take cannabis hidden in his shoe into Hawke's Bay Regional Prison.

Acting prison manager Yvonne Fuller said the boy was caught by prison staff, conducting random searches of visitors, who approached him and a woman entering the prison grounds.

"When staff asked the duo to follow them to the search area for the purposes of a routine drug dog search, the female visitor began to argue with staff, becoming very abusive and refused to comply with their request," Ms Fuller said.

"However, our staff are trained to handle such situations and acted professionally. Staff were able to successfully conduct the search, during which the drug dog indicated that drugs were concealed in the young male's shoes.

"Staff then asked to see his shoes and found concealed in his left shoe a package in black tape that contained 21 grams of cannabis leaf."

Police arrested the boy shortly afterwards. The woman was barred from entering the prison grounds for 12 months.

"Whilst it is extremely sad to see someone of this age carrying drugs, the Department of Corrections simply does not tolerate behaviour that undermines prisoners' rehabilitation and reintegration into society," Ms Fuller said.

"The majority of prisoners are going to leave prison at some point. We want them to return to the community and lead offence-free lifestyles."