The traditional view, widely accepted in Jewish and Christian traditions, credits King Solomon as the author of Ecclesiastes. This belief is primarily based on the opening verse of the book, which introduces the speaker as “the son of David, king in Jerusalem” (Ecclesiastes 1:1).
https://www.biblestudytools.com/bible-study/topical-studies/who-wrote-ecclesiastes-bible-book.html

