In practice there's a terrible accuracy problem with drug sniffing dogs. In theory there's a somewhat reasonable accuracy of drug sniffing dogs. The judicial system likes to plug their ears and pretend that drug dogs are accurate and ignore the obvious fact that dogs are fallible social creatures that first and foremost are trying to do what their handlers want them to do. If the handler wants them to check for drugs, great, but when the handler doesn't care about accuracy and just wants them to "find" drugs, it should not be shocking that the dogs behavior reflects the handler's wishes.
https://reason.com/2021/05/13/the-police-dog-who-cried-drugs...
Generally if I see a dog on the loose I'll catch them and walk them back to their owner. I've probably caught around a dozen dogs that I was a complete stranger to and my go to method is to use their empathy against them. I'll get close enough for them to take notice of me and then shift my attention to some spot in the grass and occasionally look back at the dog, put my back to them, pretend to react to the imaginary thing in the grass, etc. I can get some dog that's never even seen me before to paw at the dirt, bark, sniff incessantly, etc it's not much of a stretch to assume that a dog's handler could do the same to the dog they spend more time with than most people get to see their pets. They never scold the dog after they alert on a vehicle that doesn't turn up drugs and I'd bet money on average they receive more praise after an alert than after not alerting.