Do not include a security deposit in your income when you receive it if
you plan to return it to your tenant at the
end of the lease. But if you keep part or all of
the security deposit during any year because your tenant does not live
up
to the terms of the lease, include the amount
you keep in your income in that year.
If an amount called a security deposit is to be used as a final payment of rent, it is advance rent. Include it in your income
when you receive it.
For more information - Pub. 527 - Residential Rental Property:
https://www.irs.gov/pub/irs-pdf/p527.pdf