Dear Albany Tenant:
How many unrelated people are living in this house? A landlord is not allowed to steal the security deposit for unpaid rent, but a landlord could sue for unpaid rent. Your security deposit is YOUR money. It does not belong to the landlord and cannot be stolen from you by the landlord. The terms of the lease govern the security deposit and in New York that is usually to cover any expense incurred by the landlord after the tenancy to make repairs in the house or apartment that are caused by the tenant and are beyond ordinary wear and tear.
So who are the tenants on the lease? If you all signed the lease, you are co-tenants, not roommates. Only persons signing a lease are tenants. A tenant is allowed one roommate (and the landlord has no say in this yes or no.) A roommate has no legal relation with the landlord and does not pay rent to the landlord. The roommate pays the tenant the amount of money the tenant and roommate agreed was fair for the roommate to occupy a part of the tenant's leased premises. If the roommate does not pay the tenant, the tenant still must pay rent to the landlord. The tenant may use an eviction proceeding to evict the nonpaying roommate, or may terminate the roommate's license or "lease" or "rental agreement" and then commence a holdover proceeding to use the court process to evict the roommate.
So it sounds as though you landlord is a law unto himself, his law is illegal. You can sue him, I guess, hire an attorney, or move.
The answer provided to you is in the nature of general information. The general proposition being that you should try to avoid a bad outcome if you can.