"It's going to rain" typically implies that it will happen sooner. Ex: "It's going to rain this afternoon."
"It will rain" is used more often for the farther future, such as "It will rain the whole summer."
However, "It's going to rain" is used in common speech much more often, even for the distant future, as it's less formal. If someone was to use "It will rain" in speech, it would pretty much always be in contracted form "It'll rain this saturday."
Which one is correct? Both of them are, aren't they? Both of them express a prediction, it just depends on the perspective of the speaker.
For 'a' the speaker has the evidence of the black clouds.
For 'b' the speaker is just guessing. It is his personal opinion.
a) I think it is going to rain this afternoon.
b) I think it will rain this afternoon.
In both cases the speaker is expressing a personal opinion (after all, he says "I think"), and I would not distinguish between "will" and "is going to" on the basis that in one case the opinion is influenced by evidence, while on the other it's just a random result of crystal-ball-gazing. I'd say in both cases both versions are interchangeable.
They would still be interchangeable without "I think". Think about it. Without "I think", it would seem the speaker is stating more than an opinion, a belief verging on certainty. He is sure that it will rain. He is sure that it is going to rain. I again see it as irrelevant how he came to be certain, and if he's just guessing, he wouldn't be certain.