1. In the first period, I have a class.

2. At the first period, I have a class.
3. On the first period, I have a class.
4. In the first period, I have class.
5. At the first period, I have class.
6. On the first period, I have class.

(Which ones are grammatical?)

1 and 4 are best.

We often say,
I have a class first period.