TL;DR: That there are internal candidates shouldn't detract you from applying. After all, the only situation in which you're sure of the outcome is when you don't apply.
What follows can be rather depressing to read. It was hard to write. It is, however, a description of the (my) reality as a senior staff member with international experience in graduate school and postdoc admissions.
I've participated and chaired selection panels for postdoc positions in a number of universities. In Australia and the UK, I note that there is a requirement to advertise and interview suitably qualified candidates, even if there is no intention of hiring them. That is, the internal applicant is the preferred candidate but funders or the university requires that some hiring process be undertaken. These situations can be quite wasteful of time and is quite unjust for external applicants or even other internal applicants. There are no obvious policies around this practice; people are simply acculturated into the system of winks and nudges.
In East Asia, the situation is a little different. Here, the intention is to use the interview process to reward progress and encourage good behaviour. It was explained to me in three universities in two different countries that the application process is so tough that being invited to interview is an achievement in itself. Thus, even if there is every intention of hiring candidate A and absolutely no intention of hiring candidates B and C, the latter two candidates are interviewed nonetheless. The interviews for B and C are also conducted in a manner different from candidate A -- there is more encouragement and advice from panel members, more talk of empowerment and improvement through the use of words like "potential", "opportunity", "diligence", etc.
I've sat on panels where the internal candidate was so underqualified but had to be interviewed for HR reasons. In cases like this, the Department uses the hiring process to accomplish two things: (1) it gives political cover to terminate a contract and (2) the Department gains a new functioning member of its staff. Why is this done? Well, it is quite difficult to go through typical HR processes and this is one of the options open for them.
Finally, in some cases, the panel members and the internal candidate have established such a comfortable relationship that it becomes a case of wanting to infuse new life into the group. This is a case in which the lab decides "better the devil you don't know."
Despite all of the above, a great majority of the panels on which I've sat have tried their best to choose the most qualified candidate. Internal candidates are a disadvantage, in fact, because when they need to do a presentation, almost everyone's seen their work; when they introduce themselves, they're thrown off guard because they assume that the panel members already know them; when they are asked about their plans, they tend to parrot what they've heard from their work colleagues.
You should apply for the post if you feel you are the best suited for it. You should prepare for the selection process as you normally would. If the playing field is level, then the only time you are sure of the outcome is when you don't apply.
I wish you the best of luck.