They can be, but it depends. Should you give them credit?
It's no secret that record producers have a huge influence on how songs sound. A producer can have many roles that may include, but are not limited to, gathering ideas for the project, composing the music for the project, selecting songs or session musicians, proposing changes to the song arrangements, coaching the artist and musicians in the studio, controlling the recording sessions, and supervising the entire process through audio mixing (recorded music) and, in some cases, to the audio mastering stage.
A song is defined as the melody and the lyrics. Under these standards, the producer is not automatically entitled to songwriting credit, no matter how heavily involved they are. However, as the recording process has evolved, this standard has also changed over the last few years. It has become increasingly common for music producers to be given songwriting credit. The more influential the producer is on the song, the more arguments they have for songwriting credit.
For example, music producer George Martin is largely credited for shaping the sound of The Beatles, and is even often referred to as "the fifth Beatle". He was largely responsible for arranging and composing the music that would take their songs from guitar/vocal songs into the recording that are still known and admired today (think of the strings in the song "Yesterday"). George Martin is not listed as a songwriter on any of The Beatles' songs, despite the fact that he composed a lot of the music. Since Lennon/McCartney were the ones to compose the melody and the lyrics, they were credited as the songwriters.
However, if you fast forward to more recently, you may be familiar with record producer Benny Blanco, who has worked with the likes of Ed Sheeran, Katy Perry, and many more. Blanco is almost always given writer's credit on the songs he produces, as it can be argued his production and composition of the music has a huge influence on not only the song itself, but it's success.
Although in different times, both of these producers had similar roles in the creation of the songs of these songwriters. The only thing that changed whether or not the producer received songwriting credit was the deal that was in place.
It is important for you and your producer to come to an agreement about songwriting credit before you begin working on a project. It is also important that you keep track of the songwriting credit on a split sheet (you can learn more about that here) to avoid any conflict in the future.