Depends what you mean by ghost followers, many people use the term differently.
one way is to scrape your activity for a time period, see who is interacting with your media. Then map that to your followers, those who are not engaging (ghost followers) you can block/unblock which should remove them as followers.
if you mean those you follow which are dead accounts. Scrape followings > filter by inactivity
similar to above if you mean those that follow you but are dead accounts, but block / unblock