Gardai watched a man dig a parcel with £200,000 worth of heroin from under a sleeper on the railway line at Cherry Orchard, a jury at Dublin Circuit Criminal Court heard.
When youths wolf-whistled to warn him that he was under surveillance he dropped a parcel containing 782 grams of heroin, it was alleged.
Sgt Carroll said the digger was Anthony O'Driscoll (22), of Croftwood Park, Ballyfermot, who has pleaded not guilty to having heroin for supply at Cherry Orchard, Dublin.
The hearing continues.