NEW YORK — Even after ending his long losing streak, Matt Andriese was treated no better than a rookie.

Andriese won for the first time since June, Corey Dickerson hit a two-run homer and the Tampa Bay Rays slowed the New York Yankees’ playoff charge by stopping their seven-game winning streak with a 4-2 victory Sunday.

“They’re a good club right now. I mean, they got hot at the right time, they’re back in the race and it’s fun to take at least one from them,” second baseman Logan Forsythe said.

Forsythe and Brad Miller also went deep for the last-place Rays, who had dropped three straight and six of seven. But they prevented a four-game sweep behind Andriese (7-7) and Chase Whitley, who tossed two innings of relief in his Tampa Bay debut after returning from Tommy John surgery.

“Just very, very, very thankful,” Whitley said.

In the clubhouse after the game, young Rays players got some traditional rookie hazing. For the trip to Toronto, they dressed in USA wrestling uniforms — complete with stars, stripes and cumbersome ear guards.

And although Andriese’s rookie status expired last year when he pitched more than 65 major league innings, there was a special outfit hanging in his locker waiting for him, too.

“These actually aren’t too bad,” the pitcher said with good nature. “I’ll take it.”

Whitley struck out his first batter, rookie slugger Gary Sanchez, and gave up an unearned run. But he retired Jacoby Ellsbury on an easy fly with two runners in scoring position to protect a 4-2 lead in the seventh.

It was the right-hander’s first major league outing since he started for the Yankees at Tampa Bay on May 14 last year.

“That was pretty cool. Just unbelievable,” Whitley said. “I’ve still got a lot of friends over there. So it was just really, really fun.”

Whitley even took a photo with Yankees head physician Dr. Christopher Ahmad, who performed the pitcher’s elbow operation.

“Really cool moment,” Whitley said.

His former teammates were happy to see him back, too.

“It was a long road for him,” Yankees manager Joe Girardi said. “I wish he would have gave up a few runs today, but the rest of the way I hope he does well.”

Dickerson and Nick Franklin both had three hits for the Rays. Miller’s 27th homer ended an 0-for-17 slump.

Brad Boxberger worked a perfect eighth against the 3-4-5 hitters in New York’s lineup, and Alex Colome got three quick outs for his 32nd save in 34 attempts.

“We could not have scripted that any better,” manager Kevin Cash said. “A good bounce-back win for the guys.”

Andriese allowed one run and six hits over five innings, snapping a seven-game losing streak with his first win since June 15 against Seattle.

The right-hander won his first six decisions this season but was 0-7 with a 6.11 ERA in his past 15 outings, eight of them starts.

“I haven’t really changed the way I’ve thrown,” Andriese said. “I don’t feel like I was throwing the ball bad, it’s just a couple tough breaks here and there. But it definitely feels good to get back in the win column and just have a successful outing.”

Chase Headley homered and Brett Gardner had an RBI single among his three hits for the Yankees, who fell four games behind first-place Boston in the AL East and two back of Baltimore for the league’s second wild card.

Rookie right-hander Luis Cessa (4-1) gave up all three Rays homers in 5 2/3 innings. New York lost for only the fifth time in 18 games since Aug. 23.

TRAINER’S ROOM

Rays 1B Logan Morrison strained his left wrist when he hit a foul line drive in the fourth and left the game. “Felt it pop on that one swing,” he said. “More than likely, I’m probably done for the year.” Morrison returned from a strained right forearm on Aug. 15. … Miller was back at shortstop for the first time since Thursday, when he was hit by a pitch on the right elbow. He was the DH on Friday and played first base Saturday.

ROSTER MOVE

After the game, Tampa Bay called up LHP Dana Eveland from Triple-A Durham. To make room on the 40-man roster, the Rays designated RHP Tyler Sturdevant for assignment.

9/11 CEREMONIES

Before the game, Girardi and Yankees reliever Dellin Betances placed a wreath at the 9/11 Monument in Monument Park to honor those killed in the terrorist attacks 15 years ago. Following a moment of silence, FDNY firefighter Frank Pizzaro sang the national anthem while other firefighters unfurled a large American flag in center field — the same flag displayed when President George W. Bush threw out the first pitch before Game 3 of the 2001 World Series at the original Yankee Stadium. After their roll call of Yankees starters, the Bleacher Creatures briefly chanted “USA! USA!”

UP NEXT

Rays RHP Jake Odorizzi (9-6, 3.86 ERA) pitches Monday night in the opener of a three-game series at Toronto, where the Rays are averaging 7.5 runs in six games this year. They are 9-7 against the Blue Jays overall and need one win to clinch the season series for the eighth time in nine years.