Knicks forward Julius Randle drives against Raptors forward Scottie Barnes...

Knicks forward Julius Randle drives against Raptors forward Scottie Barnes in the first half of an NBA game at Madison Square Garden on Monday. Credit: Kathleen Malone-Van Dyke

The Madison Square Garden scoreboard called for “DE-FENSE” and the home crowd dutifully chanted it as the Knicks tried to stop the Raptors on Monday night.

After allowing a total of 279 points in a pair of losses to Milwaukee and Boston, the Knicks had to get back to defense, right?

Except these Knicks are really good at scoring. So in their first game without defense-oriented center Mitchell Robinson, the Knicks simply outscored Toronto, 136-130.

Julius Randle led the Knicks (13-9) with 34 points. RJ Barrett scored 12 of his 27 in the fourth quarter.

Jalen Brunson, who was listed as questionable for the game with a left ankle injury, played 37:34 and had 21 points and nine assists. Quentin Grimes scored 19, shooting 5-for-7 from three-point range, and Josh Hart added 16, both off the bench.

“We’re scoring the ball a lot better,” coach Tom Thibodeau said. “We’ve got to keep that edge defensively . . . I don’t want to lose sight of winning. The win’s the most important thing.”

OG Anunoby led Toronto (9-14) with 29 points. Scottie Barnes, Pascal Siakam and Dennis Schroder had 20 each.

The score was tied at 108 when Barrett put the Knicks ahead for good with a layup to start a 7-0 run. The Knicks took the first double-digit lead of the game for either team when Hart hit a running layup to make it 129-119 with 2:40 left.

After the losses at Milwaukee and Boston, playing struggling Toronto at home seemed as if it might be an oasis for the Knicks, who will play eight of their next 10 games away from the Garden.

First the Knicks head to Utah to begin a western swing on Wednesday before visiting the Nets to end a geographically challenged five-game road trip. Then the Bucks will visit the Garden for back-to-back games on Dec. 23 and Christmas Day before the Knicks head out on the road again for three more games.

The Knicks were without Robinson, who the team announced needs surgery to repair a stress fracture in his left ankle. Robinson will be re-evaluated in eight to 10 weeks.

Jericho Sims started at center with Isaiah Hartenstein (11 points, eight rebounds) coming off the bench, as he did behind Robinson.

“He actually called me before the game,” Hartenstein said. “He wished me good luck.”

Immanuel Quickley missed the game with right knee inflammation.

Randle came out firing, scoring 13 of the Knicks’ first 26 points. Second-quarter scoring included Sims’ lone basket on a dunk off an alley-oop pass from Brunson. The Knicks led 66-60 at halftime.

Randle went over the 30-point mark with a drive and ferocious two-handed dunk near the end of the third quarter. He was called for a technical foul for pulling himself up on the rim and slapping the backboard, after which he walked around the court and exhorted the already fired-up crowd.

No, he wasn’t calling for “DE-FENSE,” but nobody seemed to mind.

“I was just excited,” Randle said. “My first tech of the season. I’ll take it.”

Newsday LogoSUBSCRIBEUnlimited Digital AccessOnly 25¢for 5 months