Bring water to a boil in a large saucepan. Add potatoes and cook until tender. Drain, reserving liquid. Set aside potatoes.
Peel and finely chop onion. Melt butter in sucepan 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 - 4 minutes.
Gradually add potatoes, reserved 1 cup cooking liquid, milk and sugar to onion mixture in saucepan; stil well. Add cheese and ham Simnmer over low heat 30 minutes, stirring frequently.
Store leftovers, covered, in refrigerator.
Go to full version of