makes you wonder who wrote the script and why

Easy to determine. The director, Elaine may, wrote the screenplay. As to why, the Wikipedia article (link) on Ishtar says this:
Beatty felt indebted to May, who in addition to cowriting his 1978 hit Heaven Can Wait had done a major uncredited rewrite on the script of his Academy Award-winning Reds and helped immensely with its postproduction. He began looking for a project to do with her, one she could write and direct. She had never, he believed, had a sufficiently protective producer, and by starring and producing in her next film he could give her the chance to make the film he believed her to be creatively and commercially capable of making.

At a dinner with Beatty and Bert Fields, their agent, May said she would like to do a variant on the Road to... movies of Bing Crosby and Bob Hope, set in the Middle East. Her idea would feature Beatty and a costar as a mediocre singer-songwriter duo who would go to Morocco and get caught in the crossfire between the Central Intelligence Agency and a local left-wing guerilla group. She thought it would be funny to cast Beatty against type as the Hope part, the bumbler of the duo, while the costar, possibly Dustin Hoffman, would play the self-assured ladies' man that Crosby usually took.

Hoffman, who was also indebted to May for her extensive uncredited rewrite on Tootsie, intially turned it down due to "misgivings". At Beatty's request, the two met with May and Hoffman's creative confidant, playwright Murray Schisgal. The latter two felt that the action plot in Morocco overwhelmed the rest of the film and that it "should not leave New York". Hoffman was finally persuaded by Beatty's assurances that he would provide May with the room she needed to work.
When May finished the script, Beatty, Hoffman, and some other friends including Charles Grodin, had a meeting and read-through at Beatty's house. All present agreed that the script needed work, but it was funny and could be a hit.
May was a talented comedienne and writer, and even the most talented person is capable of creating something that's a flop. Creating a great notoriously difficult and even some of the greatest filmmakers (Griffith, Hawks, Fellini, et al) have some real duds to their names. (I just watched Hawks' Man's Favorite Sport?) yesterday, and I switched it off after about 40 minutes. It was a dismal little "comedy" with Rock Hudson in the lead.) Anyway, it's probably time i saw Ishtar, so I can judge for myself if it deserves its reputation.

Ceci n'est pas un seing.