Anthony Weiner might have more friends in prison than he does now in the Union Square building where he’s been living with his son, Jordan, 5.

The former congressman goes to the apartment tower’s gym most days wearing earbuds.

“Nobody speaks to him. He is truly ostracized,” one source told me. “People won’t even get on the elevator with him.”

Most of Weiner’s neighbors were Hillary Clinton supporters, and blame him for her loss because former FBI Director James Comey reopened the investigation into her emails after the feds seized Weiner’s computer.

Weiner will be sentenced Sept. 8 in federal District Court in Manhattan for sharing obscene photos with a minor. Prosecutors said in the plea agreement that 21 to 27 months would be “fair and appropriate.”

Since he doesn’t seem to have any friends, and his estranged wife, Huma Abedin, spent more time with Clinton than she did with her husband, Weiner might have more companionship behind bars.