"let themselves be defeated before the people of Ai." The phrase "before them" represents what the people of Ai would see and think. AT: "let the people of Ai think that the Israelites were defeated" (See: [[rc://en/ta/man/translate/figs-metonymy]])
The phrase "be defeated" can be stated in active form. AT: "let the people of Ai think that they had defeated the Israelites" (See: [[rc://en/ta/man/translate/figs-activepassive]])