Since there is no way Dumbledore can envision the future, it was impossible for him to have known what would happen. However, he was probably almost certain that Harry is very brave and loyal to him and that he would do anything to prevent the Basilisk from hurting anyone and entrusted him with this task and also sent him help through Fawkes, his Phoenix.