My dogs LOVE Arbys. And they're quite the connoisseurs on cheeseburgers too. Hold the onions, of course (onions are bad for dogs). And hold the pickles too (or Mom finds them weeks later, like wrinkled poker chips, wedged in the back seat). We don't like pickles.
Yes, you can train your dog to not take food from anyone other than you. You start much the way you train a "Leave It" command. Someone offers your dog a bland biscuit, and you draw your dog's attention away with a tasty morsel of something far better, like deli meat or a jerky treat. At first, your friend will hold the biscuit just beyond your dog's reach, and you'll put your treat in front of your dog's nose to draw her attention away. Pick a command for starters ("Upgrade!") And ask everyone you meet to work with you, offering your dog a bland snack that you override. Soon, your pup will start to look at YOU as soon as someone offers her a treat.
Then, you start to hand better treats to people, but by now, you have your command in place. Keep going. As soon as the food is put in front of your dog, before she even moves for it, that's when you want to give her the command. The point is that she should not be interested in the food, not that she should turn away from it. It's a subtle difference. As soon as she turns to you, reward that behavior with a treat.
Then you phase out the treats on your end, and replace with praise, attention, petting and playing.
The idea is that your pup knows she'll always get something better from you, whether it's a better snack, attention and love, a toy, or playing her favorite game for a few minutes.
Eventually (and it does take time) you will have a dog that won't take food from anyone. Of course, well meaning friends and family will be a little offended. But that's ok. Your pup will be safe.
And, BTW, never count on this knowledge exclusively. I always tell dog owners, when we are in public, we must pay 100% attention not only to what our dogs are doing, but even more importantly to what everyone else is doing. That means we may not be able to relax at Starbucks like we'd want to because we're always vigilant, or that we have our pockets loaded with our keys and credit cards so we don't stop to dig through our purses (which is distracting).
When we're in public with our dogs, we HAVE to pay attention, always, first and foremost. Our dogs can be perfectly trained. The public, alas, is not so trainable.