Is there a free platform to host coding challenges within a class? I've seen many platforms that allow companies to interview prospective developers by means of coding challenges, but those are always paid.

So I'm trying to find some tool where I can create my own exercises and test cases and tell my students to go solve the challenge and see if their code passes all tests, and then maybe get a rank list of whose code has better performance (in order to make it look like a "competition").

In the past I tried to host a contest through Hackerrank but it was too cumbersome and there was no way to hide lots of auto-generated code that would just confuse my students.
It doesn't do ranking in any manner, but CodingBat permits you to create challenges with tests for your class in either Python or Java.

While the interface begins assuming that you will have one method, you can add as many methods as you wish.  However, you are limited to one class (so no inner classes), and you are forbidden Exceptions, so the projects would have to be fairly small in scope.