Ask your dog to sit. Hold your hand up in a 'stop' signal and say 'Stay'. Wait just one second, then give them a treat and praise.
Gradually increase the time they must stay before you treat them. Go from 1 second to 3 seconds, then 5, and so on. Keep sessions short and successful.
Once they can stay for 10-15 seconds, start taking one step back after giving the 'Stay' cue. Step back to them to give the treat. Don't call them to you.
In a quiet area, have someone walk by at a distance, or roll a ball slowly. If your dog stays, give them a jackpot of treats! If they break, just calmly reset them in a sit and try an easier version.
Teach a release word like 'Okay!' or 'Free!' to let your dog know when the 'Stay' is over. After they've held the stay, say your release word enthusiastically and toss a treat away from them.