What was the first video game where the goal was to collect stars?

I’m guessing that it was something in the Mario franchise but I really have no idea.

It depends. You need to set more parameters.
Does it have to be stars? Many, many earlier games involved collecting items. Some games rewarded collecting all of them, some games had special rewards for individual items, etc…

For example, Pac-Man (1980) involved collecting pellets and power pellets. When you collected them all, you got to the next level.

Some games such as Gauntlet (1985) you collected keys. The Journey video game (one of my old favorites) you collect the members instruments for a concert at the end.

The Mario franchise started with Donkey Kong’s Jumpman (1981) who then reappeared as a plumber (with Luigi) in the Mario Bros. game(1983). I don’t think they started collecting coins,etc. until the NES and Super Mario Bros. (1985) was released.

I was thinking specifically of stars but coins is probably close enough.

Are you looking for games where the ONLY goal is to collect stars/coins? Because if so, Super Mario Brothers (the original) doesn’t count, because coins are a side goal at best; If you never get any, it really doesn’t matter - the ‘goal’ is really to get through the levels.