The final "Hobbit" movie hits theaters on Wednesday, and MARTIN FREEMAN hosted "Saturday Night Live" this weekend . . . he's the guy who plays Bilbo Baggins.

But he was also Tim in the original British version of "The Office".

So they did a skit where all the characters from Middle Earth play characters from the "Office". For example, BOBBY MOYNIHAN was the RICKY GERVAIS character, David Brent . . . but as Gandalf.

If you've never seen the British "Office", you might not get a lot of the references though.