The bird was seen landing in the central concourse of the medium security La Reforma jail, in San Rafael de Alajuela, where it was taken into custody.
The drugs were contained in a small zipped up pouch strapped to the animals chest.
About 14g of cocaine and at least the same amount of cannabis were inside wrapped in plastic.
Costa Rica’s Ministry of Justice and Peace released the animal’s mugshot under the headline caption “narcopaloma”, meaning “drugs dove”, and listing the date of the animals detention.
Realidad7 reported the drugs had a street value of around £180 ($281).
Prison officials said they believe the drugs were destined for use by an inmate who may have trained the pigeon to act as a courier.
Pictures of the bird were posted online under the title “drugs dove”
Director of the Penitentiary Police, Paul Bertozzi, told Spanish news agency Efe that it showed the need to be vigilant.
“Drug traffickers are using unimaginable ways to achieve their macabre atrocities,” he said.
“This (use of a pigeon) is nothing new. In the past (the traffickers) have used cats and dogs to pass drugs to prisoners. Now it seems they are using pigeons to carry in their wares from the outside.”
Although it is the first time the Costa Rican authorities said they had come across the practice, it has previously been reported in Argentina in 2013 and Colombia in 2011.
The pigeon was later taken to a zoo where it was expected to remain behind the bars of a cage.
Biologist Oscar Ramirez told Realidad7 that pigeons can be trained to travel several miles with small loads.
During the Second World War, more than 250,000 homing pigeons were used to transport messages between front line Allied troops and top brass, according to the Royal Pigeon Racing Association.