dnd 5e – Does the Invisibility spell cast on a construct also affect creatures inside it?

No.

Rules as Written

The spell invisibility reads (emphasis mine):

A creature you touch becomes invisible until the spell ends. Anything the target is wearing or carrying is invisible as long as it is on the target’s person. The spell ends for a target that attacks or casts a spell.

A creature is not an object/thing; it is a creature. If I said “anything in the house has to be washed down with bleach” or “anything left in the house when you sell it becomes the property of the new owner,” you wouldn’t expect people to be included because they aren’t things.

Rules as Intended

Jeremy Crawford tweeted about a similar abuse – having a Warlock’s familiar carry them to share their invisibility. He said:

@darthmallcore “Can pact familiar imps and quasits turn their masters invisible?”

Nope, that invisibility works on the fiend and its gear.

At the time he made the post, his tweets were considered “official rulings” although that has since changed. This doesn’t, however, change the fact that his tweet is an insight into the designer’s intent.

Why Allowing This is an Abuse

Casting invisibility on the construct takes only the base level slot (2nd). Normally, casting it on more people would require a higher level cast. If casting it on the construct with people inside makes them invisible as well it is like giving you free spell slots.

At Higher Levels. When you cast this spell using a spell slot of 3rd level or higher, you can target one additional creature for each slot level above 2nd.

Moreover, if it is cast only on the construct then the party members would be able to attack while invisible without breaking their invisibility since the attack clause only mentions the target of the spell. This makes greater invisibility (4th level) moot.

The spell ends for a target that attacks or casts a spell.