First of all, in the United Kingdom, one does not "run" for Prime Minister. One is appointed to that role by the Monarch in power and then must get a vote of confidence (or avoid a vote of no confidence) in the House of Commons.
In actuality, any male member of the Royal Family who has a peerage (such as the Duke of Kent or the Earl of Wessex), sits in the House of Lords and cannot also sit in the House of Commons. Prime Ministers in modern times must come from the House of Commons. Also, it wold be a breach of protocol if a member of the Royal Family, or any of their close relatives, were to do so. However, one could see a scenario where Peter Philips might decide to run for Parliament if his grandmother were no longer alive and be asked to form a government by his first cousin, the future King William . However, this is highly unlikely to happen since it would be unseemly to do so.,
In theory, the Monarch could appoint whomever they wanted to to be Prime Minister, and if they secured the confidence of Parliament, anyone cold get the job.