Heat 2 tablespoons of olive oil in a pot over medium-high heat.
Add the sweet potatoes and cook, stirring occasionally, until browned all over, 5 to 7 minutes.
Transfer the browned sweet potatoes to a plate and set aside.
Add the remaining 1 tablespoon of olive oil to the pot and set the heat to medium-low.
Add the onion and cook, stirring occasionally, until translucent, 5 to 7 minutes.
Add the cury paste, garlic, ginger, chile, tumeric, and cook until fragrant, about 1 minute.
Add the lentils, stock, salt and browned sweet potatoes to the pot and bring to a boil over high.
Lower the heat and simmer, uncovered, stirring occasionally, until the lentils are just tender, 20 to 25 minutes.
Add the coconut milk and simmer, stirring occasionally, until the liquid has reduced and the lentils are creamy and falling apart, 15-20 minutes.
Add the spinach and stir until just wilted, 2 to 3 minutes. Off the heat, stir in the lime juice and season with salt to taste.
Divide among shallow bowls and top with cilantro and coconut flakes, if using.