An analysis of the most kid-friendly cities in the United States shows that Detroit — the site of next week’s Democrat debates — is the worst city for raising children.

The personal finance website WalletHub compared 182 U.S.cities on 47 key metrics to determine “essential family dynamics, such as the cost of housing, the quality of local school and health-care systems, and the opportunities for fun and recreation” in each locale.

“This study aims to reveal the areas that offer the greatest opportunity to achieve Wallet Fitness and live a long and happy life,” WalletHub said of its report.

The Number One city is Overland Park, Kansas, in part because it has the “lowest share of families receiving food stamps, 3.09 percent, which is 15.2 times lower than in Detroit, the city with the highest at 46.91 percent.”

Overland Park, Kansas, also ranked Number One in affordability but 94 for the “family fun” ranking. Los Angeles, California was at the top of the list for “family fun” but was 176th for “affordability.”

The other cities rounding out the Top 10 best cities, in order from second to tenth are: Fremont, California; Irvine, California; Plano, Texas; South Burlington, Vermont; Bismark, North Dakota; Gilbert, Arizona; Fargo, North Dakota; Scottsdale, Arizona; and Boise, Idaho.

Detroit’s government dependence, among other factors, made it come in dead last at 182, and it also has the highest number of families living in poverty at 32.70 percent.

Overall, the worst cities for children, based on WallHub’s metrics, are in order from 173 to 181 (Detroit is last at 182) are: Augusta, Georgia; Baltimore, Maryland; Hialeah, Florida; San Bernardino, California; Wilmington, Delaware; Shreveport, Louisiana; Memphis, Tennessee; Cleveland, Ohio; and Newark, New Jersey.

No. 3 Irvine, California has the fewest violent crimes (per 1,000 residents), 0.61, which is 34.1 times fewer than in St. Louis, the city with the most violent crimes at 20.82 per 1,000 residents.

No. 9 Scottsdale, Arizona has the highest median family annual income (adjusted for cost of living) at $109,565, which is 3.5 times higher than in Hialeah, Florida, the city with the lowest family income, $30,889.

New York City came in at 177th for affordability and yet, according to the study, has the most playgrounds (per square root of the population), 0.6607,which is 18.9 times more than in Hialeah, Florida, which has the fewest at 0.0349.

The No. 1 city for “health and safety” is Fremont, California, and South Burlington, Vermont was on top for education and childcare.

Follow Penny Starr on Twitter