Why is it important that Santiago dreams of a child who tells him of his treasure in the abandoned church?
Santiago's dream of a child telling him about a treasure is important because it foreshadows the final location of the treasure. I would like to make it clear though that the child in the dream does not tell Santiago that the treasure is in the church. Here is that section of the text.
"Then, at the Egyptian pyramids," — he said the last three words slowly, so that the old woman would understand—"the child said to me, 'If you come here, you will find a hidden treasure.' And, just as she was about to show me the exact location, I woke up. Both times."
The child tells Santiago "if you come here." Santiago believes that "here" is Egypt. Egypt is not the location of the treasure; the church is the location of the treasure. Believing that the treasure is in Egypt, Santiago leaves on his journey. He has all manner of setbacks, but he does eventually get to Egypt. While he is in Egypt, he is robbed (once again) by bandits; however, he hears the bandits talking about a treasure that is in an abandoned church in Spain.
"In my dream, there was a sycamore growing out of the ruins of the sacristy, and I was told that, if I dug at the roots of the sycamore, I would find a hidden treasure."
Santiago now realizes that the treasure that he seeks is right back where he started his entire journey in the first place. That doesn't mean Santiago's original interpretation of the dream was wrong though. He thought "here" meant Egypt. Had Santiago not gone to Egypt, he would not have been told the specific detail of exactly where to dig. So in a way Santiago did find the location of the treasure in Egypt. He learned the location of the treasure in Egypt, and he found the actual treasure in Spain.