1. My sister and I took part in school marathon yesterday.

2. My sister and I took part in a school marathon yesterday.

3. My sister and I took part in the school marathon yesterday.

4. My sister and I took part in School Marathon yesterday.

5. My sister and I took part in the School Marathon yesterday.

6. My sister and I took part in a School Marathon yesterday.

(Which expressions are grammatical?)

If you mean your school's one and only school marathon, then 3 is correct.

If you mean one of many schools' marathons, then 2 is correct.

The others are incorrect.