If it is just the old grout and not the tiles, yes. My husband was a tile/carpet layer for years with his brother as partners in a business and they did it that way. BUT they smoothed out the grout a little in places where it was more lumpy or higher than other places on the floor
It's best to sand it as smooth as you can first. Grout tends to crumble as it gets older and it's not a great idea to have crumbling grout under your carpet. Eventually it could loosen the tiles. You don't have to get all of it off, just smooth it as DesertRose stated in her answer. Wishing you the best.
Where is the grouting?
Are you wanting to put underlay down also, or just the carpet itself?
Hello Debbie, I think you should be okay, if it is too lumpy, you could put a very thin sheet of sub floor over it then you can attach the carpet strip which allows you to tighten the carpet