
Defrel collected a pass from Manolo Gabbiandini and, despite being surrounded by three defenders, scored with a scuffed shot in the 81st minute before Caprari curled in an exquisite free kick in stoppage time.
Allegri, who won five Serie A titles with Juventus, fielded his 38th different starting line-up in as many league games this season as he gave a first appearance of the campaign to third-choice goalkeeper Carlo Pinsoglio and a first start for Brazilian winger Matheus Perreira while resting Cristiano Ronaldo.
Sampdoria forward Fabio Quagliarella, 36, was close with an overhead effort in the first half and ended the campaign with 26 goals.
He is almost certain to finish as Serie A’s top scorer with his nearest rivals four goals behind.