You gotta be in it to win it.

Peter Cooper Village/Stuyvesant Town is conducting a lottery for 15,000 waiting list positions which will be used to fill 5,000 “affordable” apartments as they become available, City Council Member Daniel R. Garodnick announced Tuesday.

After long negotiations with the complex’s owners, The Blackstone Group and Ivanhoe Cambridge, the city managed to get 5,000 of the 11,250 units in the massive complex — once a shangri-la of middle class Manhattan life — designated as “affordable” until at least 2035.

Applications are on line at www.pcvstlottery.com and must be received by March 31.

Applicants must plan to use their apartment as a primary residence, cannot have combined assets of more than $250,000 and all members of a household cannot be students. Preference will be given to residents of the city.

Rents and earning limits are based on area median income: A person making $36,300 - $48,400 would pay $1,210 a month for a studio apartment but a person earning $74,850 - $99,825 would pay $2,495 for the same unit.

Five bedroom apartments – which would be inhabited by five to 10 people will rent for $4,560 a month to households making $136,800 to $210,870 a year.

The lottery will randomly order applications from one to 15,000. Applicants selected for the list will be required to pay filing fees of $50 to $75 to determine eligibility. (And yes, a poor credit history could kick you out of consideration.)

“Some residents have expressed concern about new residents arriving via the lottery process, said Dennis Mulligan, 78, a retired NYPD homicide detective who has lived in Stuy town since 1987.

But most agree that families who plan to stay are “preferable to the students,” in the complex who pay market rates and overcrowd apartments, he said. “The students party, get drunk and leave a mess in the hallways,” Mulligan said.