My dog won’t stop barking at people as they walk past the gate. How do I stop him?

Take him out for more walks and do not allow him access to the gate. Most “garden gate” dogs do this, they bark, the person carries on walking past, dog has won as man has gone and dog feels good so does it again the next time. This whole process is reinforcing as every time he barks he is rewarded since the man goes and so the more he will do it the next time. Collie types are often quite busy dogs and if you don’t have them working for you they generally go self-employed and make up their own fun. Take dog from gate and spend more time doing fun things together.