The classic "If" is Kipling's wonderful contribution to the genre of inspirational poetry.
The first stanza, with its admonitions to "keep your head" and "make allowances" is an amazingly concise and accurate primer on the development of a well rounded person. And yes, self confidence is a big part of that.
To be able to stand in the midst of confusion, to bear up under the weight of disagreement from others, to wait patiently for results and to not allow the opinions of others to stop you are requirements to being able to effectively function in life. This is only possible "if" you believe in yourself.
The first lines in the first stanza of Rudyard Kipling's poem If are direct expressions of the author's emphasis on self-confidence and moral courage:
If you can keep your head when all about youAre losing theirs and blaming it on you,If you can trust yourself when all men doubt you,But make allowance for their doubting too;
The opening paragraph of Kipling's poem If-- provides a model and a framework upon which the rest of the poem is built. It defines what mature self-confidence is--it includes poise, faith in one's own judgment, compassion for those who doubt you, patience, personal integrity, kindness in the face of hatred, and genuine humility about how one fits into the world objectively.