CHAPEL HILL, N.C. (AP) — The script has become too familiar for No. 9 Duke. The Blue Devils once again lost their poise, the ball and ultimately, another game.

All of a sudden, a season that began with another No. 1 ranking is in danger of coming unraveled.

"We've got to figure out something," star freshman Marvin Bagley III said. "We can't continue to lose games like this."

Duke lost for the third time in four games, falling 82-78 to No. 21 North Carolina on Thursday night to slip into a tie for third place with No. 25 Miami in the Atlantic Coast Conference standings.

The Blue Devils (19-5, 7-4) dropped a full four games behind the second-ranked Virginia team that started this slide by coming to Cameron Indoor Stadium and handing them a 65-63 loss on Jan. 27.

This one was particularly tough for the Blue Devils, both because it came against their fiercest rival and because it bore such a strong resemblance to the one that preceded it, an 81-77 setback against a St. John's team that entered winless in its conference. In both games, Duke allowed a halftime lead to evaporate amid some sloppy second-half play.

But while coach Mike Krzyzewski called his team's play against St. John's "disgusting," he came away from the UNC loss with a better feeling.

"I thought we played a lot better, a lot harder and a lot more together," Krzyzewski said. "We just have to keep working at it."

The Blue Devils — who averaged more than 15 turnovers in their first four losses — had just eight giveaways against the Tar Heels, but five came in the second half.

The biggest one may have been when senior Grayson Allen threw the ball to UNC's Kenny Williams with 20 seconds left in a two-possession game, leading directly to a game-sealing dunk by Theo Pinson.

"Just keep our poise, man," Bagley said. "We kind of started to rush things, and had some turnovers and left them for open 3s, and they executed on that stuff. ... They continued to run out with the lead, so we've just got to learn how to keep our leads and keep the ball and not turn it over."

Defense has been a season-long issue— and arguably a multiyear issue — for the Blue Devils, who fell to 79th in Ken Pomeroy's defensive efficiency rankings and forced just two turnovers against UNC.

Boston College, the first team to beat Duke this season, hit 15 3-pointers in that victory and the Tar Heels made 11 of them in this one.

Some struggles are inevitable with a roster full of freshmen, and Duke starts four potential one-and-done players along with Allen.

And with this much talent on the roster, things can turn back around in a hurry.

The Blue Devils had a similar stretch of three losses in six games in 2015 behind a freshman-dominated team, then flipped the switch in March and claimed the program's fifth national title.

"At times this year when we haven't played well, we haven't executed what we've diagrammed and at the start of the second half we did not execute what we had diagrammed at halftime," Krzyzewski said. "You get confused, because what you said you were going to do, you're not doing ... especially with younger guys."

___

More AP college basketball: https://collegebasketball.ap.org and https://twitter.com/AP_Top25