1. Make no mention of your application unless you get an interview: Even if you strongly feel that there will be no adverse impact to your relationship, there is no need to share news of your application before you get an interview. If you fail the initial screening, there is no affect on your relationship, so why say something that could have an impact if there is no impact? Keep it to yourself until something actionable occurs.
2. If the conversation needs to occur, be honest and upfront: If you find out that you have been accepted for an interview, there is still a chance that you will not get hired and your friend will never know. But at this stage, it is likely that the identity of the candidates will be revealed, particularly if the interviews are conducted by groups. It is now time to have the conversation. When you tell your friend, do so in a private place, preferably in person, and be direct with the fact that you assessed the opportunity yourself, felt it was a good fit for you and right for your career, and that you decided to apply. Emphasize that your reasons had nothing to do with your friendship and your hope that it will not be affected.
3. Expect relationship strain: Despite every attempt to placate your friend, there still could be strain on your relationship. Some friends could be slightly hurt by this news, and others could see it as an out-and-out betrayal. If you have come this far, you should expect to encounter any of these reactions and determine, for you, if the impact on your relationship is worth it. Friends with strong relationships will be able to pull through, while others may not be able to. You have to be open to all possibilities and be ready to accept the consequences of your decisions.
Two friends applying for the same position can be a true test of a relationship. But through objectivity, planning, and honesty the situation can be handled with grace. Good luck!