The Mets may have struggled to keep their stars healthy this season, but all indications are the team’s longtime trainer, Ray Ramirez, won’t be made a scapegoat for those injuries.

Multiple team sources have said in recent days that Ramirez is safe for 2018, even after a season in which Noah Syndergaard, Yoenis Cespedes, Jeurys Familia and Matt Harvey, among others, had extended stays on the disabled list.

Ramirez, who became the Mets’ head trainer before the 2005 season, has long been a target of fans who are angry with the manner in which the organization handles injuries. In home openers, when the entire support staff is introduced, Ramirez regularly receives among the highest volume of boos at Citi Field.

But Ramirez remains well-respected by the team’s top officials, who deem the criticism unwarranted.

Along the same lines, general manager Sandy Alderson recently told The Post the club intends to retain Mike Barwis, the team’s senior advisor for strength and conditioning. Barwis has a close working relationship with Cespedes and is deemed important in trying to keep the star outfielder on the field in 2018.

Cespedes, who was shut down in August, had two stints on the disabled list this season with hamstring injuries and played only 81 games, after signing a four-year contract worth $110 million last November.

In a recent visit to the team, Cespedes spoke to reporters and revealed plans to concentrate on running this offseason in an attempt to strengthen his legs.

Club officials are working to improve the lines of communication between the players, training staff, front office and dugout and hope that will solve some problems next season. But this season’s barrage of injuries is blamed more on misfortune than on protocols followed by the team.

Even so, the sore lat muscle that kept Syndergaard sidelined for 4 ½ months, was a glaring example of a situation that might have been prevented with stricter protocols in place. In the days before he sustained the injury, Syndergaard refused Alderson’s request that he receive an MRI exam. Syndergaard was then allowed to pitch in Washington on April 30 and tore the lat muscle.

Club officials also pointed out Syndergaard worked out independently of Barwis last offseason. The All-Star pitcher then reported to spring training boasting that he had added 18 pounds of muscle.

Ramirez and Barwis, along with Alderson — who is expected to receive a new contract next week — will be spared the blame, but manager Terry Collins and pitching coach Dan Warthen are unlikely to receive the same consideration. According to sources, both are expected to receive official notification in the coming days that they won’t be retained for next season.

Finding a replacement for the 68-year-old Collins (candidates include Robin Ventura, Joe McEwing, Alex Cora, Kevin Long, Bob Geren and Chip Hale) will take precedence over filling the remainder of the staff.

Bench coach Dick Scott, third-base coach Glenn Sherlock, first-base coach Tom Goodwin and bullpen coach Ricky Bones appear likely to return, but Long, whose contract as hitting coach is set to expire, could leave if he isn’t promoted to manager.

In addition, Bones is a candidate to replace Warthen, meaning the team would need a new bullpen coach. Assistant hitting coach Pat Roessler could move into Long’s spot if Long is hired as manager or departs the organization.