Luckily, the vandals were disturbed before they got to the steam engine which pulls the carriages.
But they still managed to cause £3,000 worth of damage.
The train was parked in sidings in North Yorkshire when the vandals struck, the Sun newspaper reported.
The train is really called the Olton Hall but it has been hired out for the films about the boy wizard.
Heartbreaking
The Hogwarts Express takes Harry and his pals from platform nine and three-quarters at London's King Cross station to the school of witchcraft and wizardry.
In real life, the train takes tourists from Scarborough to York.
A spokesman for the company which operates the train said the graffiti attack was "heartbreaking".
"This will horrify the millions of Harry Potter fans," he added.