I think it's worth remembering that we as a society frame being "stupid" as an overly simplified concept. I am NOT saying that intelligence is not a thing at all, however it's much more complicated than most people make it seem. It's not as simple as high IQ = smart at everything and vice versa, Some people may be very "smart" in some things while seeming "stupid" in others, and it's actually quite common for people to have varying levels of intelligence in different areas.
Someone's ability to solve math problems can be completely different from their skills of critical thinking while forming opinions, ability to read complicated texts, inferring consequences of events, skills at reading people's intentions etc.
I am not saying these are COMPLETELY unrelated, because these tasks share some cognitive skills needed for them - but in different proportions. Even what people generally frame as "life skills" mean a wide range of different abilities.
Honestly feeling stupid was often what caused me to hate myself and be suicidal. I guess the reason why it distressed me so much was probably that it made me feel like I was inherently "not made" for intellectual work, while it was one of not many things I enjoyed - I always somehow liked solving problems, learning new things and understanding them so being "stupid" for me basically meant "you're inherently not made for the only thing that you enjoy". I have really bad working memory and basically cannot process more complex information without taking notes that reflect my mental process - and, believe me, that alone can make someone look and feel like a complete idiot in proper circumstances. What we consider "intelligence" is many more factors, though and over time I realized that I am overall just average, probably. I don't think it's fair to call someone a complete idiot if their "intelligence" depends on whether or not they are allowed to doodle on a piece of paper.
What is also important is that there are many factors *why* someone may struggle in certain cognitive tasks. Many people think of intelligence as innate and "built in", and sure, people do have different predispositions - but having experience in something actually changes a lot, sometimes in seemingly unrelated skills. I really realized this while learning to solve more advanced math problems, sometimes it was actually a matter of getting to know certain techniques and being used to them.
Someone's emotional state can also heavily influence their cognitive skills, both at a given moment and long term. It's not uncommon for people to loose their ability to think under (even subconscious) stress, and generally speaking emotions often interfere with thinking a lot - like fuck for me anxiety completely removes my ability to form sentences sometimes, even if I don't "feel" anxious. Also mental illnesses like depression or c-ptsd can "hide" someone's actual cognitive skills for years and it's a recognized symptom. Even the belief that you're good/bad at something can decide whether or not you succeed in it, because if you think you're going to fail, then your mind will have less motivation to actually do the work and will be more likely to give up quickly. The same outcomes can come from different sources.
I met so many people whose cognitive skills in different areas varied dramatically, like people who were brilliant at math problems while they had zero skills of critical thinking - I also experienced very dramatic effects of my personal feelings (mostly anxiety but not only that) influencing my ability to think. Call it all a cope, since like I said "being stupid" is something I was also very afraid of, but as a matter of fact, intelligence/stupidity is complicated and I really think it should be taken into account.