Can a spell with an attack roll be used as the attack in the Attack action or as part of the Extra Attack feature?

The short answer is no. As explained in the Player’s Handbook, you can take one action on your turn in combat, in addition to moving. You choose your action from the options available to everyone-options such as Attack, Cast a Spell, and Dash-or you choose from among the special actions you’ve gained from a class, a feat, or another source.

If you want to cast a spell on your turn, you take the Cast a Spell action. Doing so means you’re not taking the Attack action or any other action. It is true that a number of spells, such as fire bolt and ray of frost, involve making an attack, but you can’t make such an attack without first casting the spell that delivers it. In other words, just because something involves an attack doesn’t mean the Attack action is being used.

By extension, the Extra Attack feature (given by several classes, including the fighter and paladin) doesn’t let you cast extra attack spells. That feature specifically relies on the Attack action, not the Cast a Spell action or any other action.

In summary, to make a spell attack, you have to first cast a spell or use a feature that creates the spell’s effect. A game feature, such as Extra Attack, that lets you make an attack doesn’t let you cast a spell unless it says it does.