Conor McGregor was booked to appear on an episode of "Vikings" this year -- but canceled just hours before he was supposed to shoot his scene ... this according to one of the stars of the show.

We spoke with Katheryn Winnick -- who plays Lagertha on the show -- and she told us she personally wrote a role for the UFC star in an episode that she was directing.

But, when McGregor canceled right before the shoot -- Winnick says she was forced to scramble and change the entire scene.

Winnick has been an actor on the show since day 1 -- but only started directing episodes in 2018 ... so the incident must have occurred this year.

Winnick says she's not bitter -- in fact, she's even cracking jokes about the experience -- but you can bet she would have much rather had him show up and do the scene.