Transparency should be your default option. It will certainly help in this case. You can put a good case to your line manager that will have them take a positive approach. This case is:
- You don't want to spring any surprises on your line manager
- You are looking for a change in your career
- You want to continue to support your current employer and leave on a good note
- Therefore you're tell them about this now, so they can plan accordingly
- Reassure them that you don't intend to talk about this openly to the rest of the team, to avoid them getting demotivated. It will just be for those who need to know.
You can then talk more generally to your line manager about what you're doing: applying for a contract position in the same company, and seeking opportunities elsewhere. Once your they realise they can't keep you in your current job they may actually help you with the contract role in your current company. And if you apply for the company role you have no fears about HR talking to your line manager.
It will certainly be to your benefit if your line manager knows what you're doing. You won't need to sneak around going for job interviews, and it sounds good in interviews if you say you've already told your boss you're leaving -- it shows you are an honest individual. I have done this before, it worked extremely well.
In this scenario there is no conflict of interest. You've put all your cards on the table, and no-one gets any nasty surprises.