Allegri believes that the Italian international's arrival has boosted his team following a disappointing first half to the season.
"I think the club have made a very good buy with Mario, at a decisive moment in the championship," the 45-year-old told Sky Sport Italia.
"We are making a big comeback now and I am happy with the players.
"Niang worked very hard for the team tonight. He is very young, but has helped out a lot in all areas."
Milan take on Barcelona in the first leg of their Champions League last-16 tie at the San Siro on Wednesday.