Could they have chosen the other way? I don't think so. No. This is more of a philosophical question.
The LORD told Moses what the people would do after Moses died; they would play the harlot after strange gods. They would forsake him and break his covenant which he made with them. Deu. 31:16
He even knew what was in their heart even before he rescued them."for I know the purposes which they are
already forming, before I have brought them into the land that I swore to give.”
Deut. 31:21
So the people said they would serve the LORD. But they would not heed Joshua's warning; the LORD would destroy them if they went after false gods to serve them. So Joshua set up a great stone as a witness against Israel if they ever went after false gods to serve them.
The point is everything happened as the LORD said, so in that sense it was predestined.
Judges 2:11
And the
people of Israel did what was evil in the sight
of the Lord and served the Ba′als;
Judges 2:12
and they forsook the Lord, the God
of their fathers, who had brought them out
of the land
of Egypt; they went after other gods, from among the gods
of the
peoples who were round about them, and bowed down to them; and they provoked the Lord to anger.