The pilots job is to flythe aeroplane, it's someone elses job to profile passengers. If these passengers were profiled and allowed to board the plane, the pilot should have shut his cockpit door and got on with his work.

Unless there is some sort of a threat to the flight, the pilot has no right to refuse.