Clean and pick through lentils, removing any debris. Place the lentils in a small saucepan, cover with plenty of water, bring to a boil, and cook for 12 to 15 minutes, until the lentils have softened but still have a little bite. Drain and set aside.
Peel the onions and slice thinly. Place on a large platter, sprinkle with the flour and 1 teaspoon salt, and toss to mix well with your hands.
Heat the oil in a medium heavy-bottomed skillet placed over high heat. Make sure the oil is hot by throwing in a small piece of onion; it should sizzle vigorously. Reduce the heat to medium-high and carefully (it may spit!) add a quarter of the sliced onion. Fry for 5 to 7 minutes, stirring occasionally with a slotted spoon, until the onion takes on a nice golden brown color and turns crispy (adjust the temperature so the onion doesn’t fry too quickly and burn). Use tongs to transfer the onion to a baking sheet lined with paper towels and sprinkle with a little more salt. Repeat with the other three batches of onion.
Discard oil, leaving 2 tablespoons in skillet (See Note 1). Place over medium heat and toast the cumin and coriander seeds for a minute or two. Add the rice, turmeric, allspice, cinnamon, sugar, remaining 1/2 teaspoon salt, and black pepper. Stir to coat the rice with the oil and then add the cooked lentils and the water. Bring to a boil, cover with a lid, and simmer over very low heat for 15 minutes.
Remove from the heat, lift off the lid, and quickly cover the pan with a clean tea towel. Seal tightly with the lid and set aside for 10 minutes.
Finally, add half the fried onion to the rice and lentils and stir gently with a fork. Pile the mixture in a shallow serving bowl and top with the rest of the onion.