مَرَرْتُ بِغُلَامِي — I passed by my servant.
مَرَرْتُ is a past verb with the subject tāʾ.
بِـ is a preposition.
غُلَامِي is genitive under bi- with its case ending estimated; -ī is separately the mudāf ilayh in genitive position.
The governing preposition establishes the noun’s genitive case.