During the closing stages of the fixture at Old Trafford, Marcus Rashford scored from close range after the ball had struck the post, but the England international had been in an offside position when Marouane Fellaini had last touched the ball.
The assistant required help from the referee before putting his flag up, but Gallagher says that credit should be given for how the decision was made.
Gallagher told Sky Sports News: "This is an unbelievable decision because it came at such speed, and what you have to remember is his focus will be on Marouane Fellaini, the ball comes back off the post.
"He then has a snapshot in his mind of where was Rashford when he played the ball, and that is what he has done fantastically and it was quite rightly disallowed, but easy watching on the video."
United eventually prevailed by a 2-1 scoreline thanks to Fellaini's last-minute goal.