Bubó is always trying to help the patients. In that episode, they had to catch the bookies on fixing the game. Note that the bookmakers were literally buck-makers, as in the male goats.
So the doc asked the patsy mule on how they are fixing the horse race, and then he gave him some sugar to screw up the plans. The buckmakers of course protested, which made it obvious they were trying to cheat, so Sergeant Beak could, er, book'em.
Unfortunately, Ursula (the docs assistant) bet on the losing horse which ended up winning, so the doctor became a prime suspect in fixing the horse race for the sake of profit. He used the money they won to pay the bail.