1. Peel potatoes and cut into 1-inch cubes. Bring water to a boil in large saucepan. Add potatoes and cook until tender. Drain, reserving liquid. Set aside potatoes. Measure 1 cup cooking liquid, adding water, if necessary; set aside.
2. Peel and finely chop onion. Melt butter in saucepan over medium heat. Add onion to saucepan; cook, stirring frequently, until onion is translucent and tender, but not brown. Add flour to saucepan; season with pepper flakes and black pepper to taste. Cook 3 minutes.
3. Gradually add potatoes, reserved 1 cup cooking liquid, milk and sugar to onion mixture in saucepan; stir well. Add cheese and ham. Simmer over low heat 30 minutes, stirring frequently.