The Holy Spirit did not make the decision to keep or discard certain Gospels. That decision was made by the Church Hierarchy in the Roman Empire (at that time Christianity was the official religion) and was based on many factors. The below article actually provides a pretty good explanation of what was considered.
The Story Of The Storytellers - The Emergence Of The Four Gospel Canon | From Jesus To Christ | FRONTLINE | PBS
Who decided exactly what got in and what was left out? What was excluded? What was suppressed?
It's hard to say.... We do have a document called the Muratorian Canon ... which tells us that one of the criteria for deciding whether a book is scripture or not is whether it can be read in the church. Now, this seems to be rather a circular argument, because you probably don't read it in the church unless you think it's scripture, but there seems to be something about suitability for public reading during worship, that's one criterion. The churchmen who argued about these points of what's in and what's out... [also] wanted to say if we know a book was supposedly written by an Apostle or by a follower of an Apostle, this gave it some authenticity. This was an attempt to say, "We're as close back with eyewitness reporting as we can be."
FROM MANY GOSPELS TO FOUR
The
diversity of Christianity is certainly closely related to the proliferation of gospels. Even the gospels which we have in the canon of the New Testament are not of one mind, but really represent very different religious positions and very different images of Jesus. You go beyond this, we have the
Gospel of Thomas, which again is a very different image of Jesus as the revealer of the divine truth about the ultimate human self than we find in Mark, or in Matthew. We have numerous fragments of other gospels, which sometimes we only know they existed, but cannot really say what they [said].
So the question of establishing some authority in terms of gospels, which gospels should be read and which should not be read, was discussed in the second century, especially after Marcion. Marcion lived in the first half of the second century. He was a wealthy ship owner and ship merchant. He came from northern Turkey... to Rome and he gave the Roman Church a lot of money, and they welcomed him with open arms. But he felt that the original Christian gospel was no longer preserved, and he thought that only the apostle Paul had the true gospel. And he set out to find this true gospel, and he took the Gospel of Luke and purified it from whatever he thought was Jewish and said, "This should be the scripture for the church, and this should be the only scripture for the church." And the Roman church became very suspicious of his manipulations with the Gospel of Mark. It is reported that they gave the money back to him and said, "Thank you very much, but we don't want you and your gospel...."
But the church really had to think at that point, what should they do with the many gospels on hand. And with new editions of the gospels which were coming out all the time. Right after Marcion, we have evidence from Rome that some other people sat down and wrote a new harmony of the gospels of Matthew and Mark and Luke, melding them together into one gospel. Now in that situation we have apparently a recourse to the original function of gospel narrative which is the narrative of Jesus' suffering and death as the story that accompanies the celebration of the central Christian ritual, the Eucharist. And that meant that only gospels who have a passion narrative can be included. The Gospel of Thomas does not have a passion narrative. And it was never discussed for possible inclusion. It is characteristic that all gospels of the canon have a passion narrative because the central Christian ritual, that's the Eucharist, cannot live without that story. And it is out of that movement that the four gospel canon arises. And it comes, interestingly enough, as a canon that preserves diversity, within limits.... There is no claim that this canon represents four gospels that are all saying the same thing. It is rather an attempt to bring together as many Christian communities that were bound to a particular gospel into one major church. And this was essentially accomplished through the four gospel canon.