I am building a stateful contract where I want to check whether the account calling is a stateless contract. Is there any way of doing this?
There is no way to know what was used to signed a given transaction from a smart contract.
In particular, it is not possible to make such a check in general.
That being said, what you can do is check that the address of the sender is the address of the stateless smart contract. Note however that this check only works if the smart contract prevents rekeying. Otherwise, someone can rekey the smart contract address.
Why are you trying to make this check?
In my application, i want to only assign a specific role if it the address is controlled by a stateless contract
If you have the stateless contract compiled you have its address. You can code that into your stateful contract to check if that is the sender of a transaction. For example
txn Sender addr F4HJHVIPILZN3BISEVKXL4NSASZB4LRB25H4WCSEENSPCJ5DYW6CKUVZOA ==