Most scholars agree that the following story, told by the Jewish historian Flavius Josephus in his Jewish antiquities 11.317-345, is not true. One argument is that Alexander is shown a book that was not yet written. Another argument is that the story is a bit too good to be true: the Samarians, the eternal rivals of the Jews, blacken the Jews and get permission to build a temple of their own, Alexander visits Jerusalem, understands that he owes everything to the God of the Jews, allows them the privilege to live according to their ancestral customs and behaves rather unkind towards the Samarians. If a Jew in the second century BCE were to invent a story, he would write something along these lines.
On closer inspection, however, we may notice some odd details. In the first place, the Samaritans are allowed to keep their temple: not exactly something a Jew would invent, and in fact a plausible punishment for the Jewish refusal to send soldiers. In the second place, in fact, Alexander gives the Jews no privileges at all: everything he grants the Jews, had already been granted to them by the Persian kings. This was Alexander's usual policy.
In the third place, the idea that Alexander had had a vision in which the God of the Jews played an important role is just too incredible to be invented: everyone knew that Alexander claimed to be the son of the Egyptian god Ammon. Nobody would invent a special link to the Jewish God. The easiest explanation is that Alexander did indeed sacrifice to the God of the Jews.
Another aspect that deserves to be mentioned is Alexander's demand for auxiliaries and the presents the Jews formerly had sent to the Persian government. This matches the demand made by Alexander to Darius that he would address him as the master of the Persian possessions.
The following translation was made by William Whiston.
Alexander visits Jerusalem
[11.317] So when Alexander besieged Tyre, he sent an epistle to the Jewish high-priest, to send him some auxiliaries, and to supply his army with provisions;note[This detail is almost certainly authentic. Alexander besieged Tyre in the first half of 332 and desperately needed food supplies.] and that what presents he formerly sent to Darius, he would now send to him, and choose the friendship of the Macedonians, and that he should never repent of so doing.
[11.318] But the high-priest answered the messengers, that he had given his oath to Darius not to bear arms against him; and he said that he would not transgress this while Darius was in the land of the living. Upon hearing this answer, Alexander was very angry;
[11.319] and though he determined not to leave Tyre, which was just ready to be taken, yet as soon as he had taken it, he threatened that he would make an expedition against the Jewish high-priest, and through him teach all men to whom they must keep their oaths.
[11.320] So when he had, with a good deal of pains during the siege, taken Tyre, and had settled its affairs, he came to the city of Gaza, and besieged both the city and him that was governor of the garrison, whose name was Babemeses.note[Other sources call him Batis.]
[11.321] But Sanballatnote[The Samaritan leader.] thought he had now gotten a proper opportunity to make his attempt, so he renounced Darius, and taking with him seven thousand of his own subjects, he came to Alexander; and finding him beginning the siege of Tyre, he said to him, that he delivered up to him these men, who came out of places under his dominion, and did gladly accept of him for his lord instead of Darius.
[11.322] So when Alexander had received him kindly, Sanballat took courage, and spoke to him about his present affair. He told him that he had a son-in-law, Manasseh, who was brother to the high-priest Jaddus; and that there were many others of his own nation, now with him, that were desirous to have a temple in the places subject to him;
[11.323] that it would be for the king's advantage to have the strength of the Jews divided into two parts, lest when the nation is of one mind, and united, upon any attempt for innovation, it prove troublesome to kings, as it had formerly proved to the kings of Assyria.
[11.324] Whereupon Alexander gave Sanballat leave so to do, who used the utmost diligence, and built the temple, and made Manasseh the priest, and deemed it a great reward that his daughter's children should have that dignity;
[11.325] but when the seven months of the siege of Tyre were over, and the two months of the siege of Gaza, Sanballat died.
Now Alexander, when he had taken Gaza, made haste to go up to Jerusalem;
[11.326] and Jaddus the high-priest, when he heard that, was in an agony, and under terror, as not knowing how he should meet the Macedonians, since the king was displeased at his foregoing disobedience. He therefore ordained that the people should make supplications, and should join with him in offering sacrifice to God, whom he besought to protect that nation, and to deliver them from the perils that were coming upon them;
[11.327] whereupon God warned him in a dream, which came upon him after he had offered sacrifice, that he should take courage, and adorn the city, and open the gates; that the rest should appear in white garments, but that he and the priests should meet the king in the habits proper to their order, without the dread of any ill consequences, which the providence of God would prevent.
[11.328] Upon which, when he rose from his sleep, he greatly rejoiced, and declared to all the warning he had received from God. According to which dream he acted entirely, and so waited for the coming of the king.
[11.329] And when Jaddus understood that Alexander was not far from the city, he went out in procession, with the priests and the multitude of the citizens. The procession was venerable, and the manner of it different from that of other nations. It reached to a place called Sapha, which name, translated into Greek, signifies a prospect, for you have thence a prospect both of Jerusalem and of the temple.
[11.330] And when the Phoenicians and the Samarians that followed him thought they should have liberty to plunder the city, and torment the high-priest to death, which the king's displeasure fairly promised them, the very reverse of it happened;
[11.331] for Alexander, when he saw the multitude at a distance, in white garments, while the priests stood clothed with fine linen, and the high-priest in purple and scarlet clothing, with his mitre on his head, having the golden plate whereon the name of God was engraved, he approached by himself, and adored that name, and first saluted the high-priest.
[11.332] The Jews also did all together, with one voice, salute Alexander, and encompass him about; whereupon the kings of Syria and the rest were surprised at what Alexander had done, and supposed him disordered in his mind.
[11.333] However, Parmenion alone went up to him, and asked him how it came to pass that, when all others adored him, he should adore the high-priest of the Jews? To whom he replied, "I did not adore him, but that God who has honored him with his highpriesthood;
[11.334] for I saw this very person in a dream, in this very habit, when I was at Dion in Macedonia, who, when I was considering with myself how I might obtain the dominion of Asia, exhorted me to make no delay, but boldly to pass over the sea thither, for that he would conduct my army, and would give me the dominion over the Persians;
[11.335] whence it is that, having seen no other in that habit, and now seeing this person in it, and remembering that vision, and the exhortation which I had in my dream, I believe that I bring this army under the Divine conduct, and shall therewith conquer Darius, and destroy the power of the Persians, and that all things will succeed according to what is in my own mind."
[11.336] And when he had said this to Parmenion, and had given the high-priest his right hand, the priests ran along by him, and he came into the city. And when he went up into the temple, he offered sacrifice to God, according to the high-priest's direction, and magnificently treated both the high-priest and the priests.
[11.337] And when the Book of Daniel was showed him wherein Daniel declared that one of the Greeks should destroy the empire of the Persians, he supposed that himself was the person intended.note[The text Flavius Josephus has in mind may be Daniel 7:6; 8:3-8, 20-22; 11:3. Unfortunately, modern research has shown convincingly that the Book of Daniel was written in about 165 BCE.] And as he was then glad, he dismissed the multitude for the present.
But the next day he called them to him, and bid them ask what favors they pleased of him;
[11.338] whereupon the high-priest desired that they might enjoy the laws of their forefathers, and might pay no tribute on the seventh year.note[These conditions already existed in the Achaemenid Rmpire.] He granted all they desired. And when they asked him that he would permit the Jews in Babylon and Media to enjoy their own laws also, he willingly promised to do hereafter what they desired.
[1.339] And when he said to the multitude, that if any of them would enlist themselves in his army, on this condition, that they should continue under the laws of their forefathers, and live according to them, he was willing to take them with him, many were ready to accompany him in his wars.
[11.340] So when Alexander had thus settled matters at Jerusalem, he led his army into the neighboring cities; and when all the inhabitants to whom he came received him with great kindness, the Samaritans, who had then Shechem for their metropolis - a city situate at Mount Gerizim, and inhabited by apostates of the Jewish nation - seeing that Alexander had so greatly honored the Jews, determined to profess themselves Jews.
[11.342] Accordingly, they made their address to the king with splendor, and showed great alacrity in meeting him at a little distance from Jerusalem. And when Alexander had commended them, the Shechemites approached to him, taking with them the troops that Sanballat had sent him, and they desired that he would come to their city, and do honor to their temple also;
[11.343] to whom he promised, that when he returned he would come to them. And when they petitioned that he would remit the tribute of the seventh year to them, because they did but sow thereon, he asked who they were that made such a petition;
[11.344] and when they said that they were Hebrews, but had the name of Sidonians, living at Shechem, he asked them again whether they were Jews; and when they said they were not Jews, "It was to the Jews," said he, "that I granted that privilege; however, when I return, and am thoroughly informed by you of this matter, I will do what I shall think proper."
[11.345] And in this manner he took leave of the Shechemites; but ordered that the troops of Sanballat should follow him into Egypt, because there he designed to give them lands, which he did a little after in Thesis, when he ordered them to guard that country.