The Holy Spirit does distribute the spiritual gift of the discerning of spirits to whom He will.
What does that mean, exactly?
That the Holy Spirit selects some within the Church of JESUS Christ to receive the supernatural gift to discern whether another is being influenced and motivated by those spirits which follow God or by those spirits which follow Satan.
Such a gifting (as well as all other spiritual giftings) are given for the express benefit of the Church of JESUS Christ.
SD