The preposition in is used with accusative case if the verb shows movement from one place to another, whereas it is used with dative case if the verb shows location.
(in + dative) in; within; at; contained byEs ist im Haus. ― It is in the house.
(in + dative) pertaining to
(in + accusative) intoEr geht ins Haus. ― He goes into the house.