It’s an Undecidable problem, so no algorithm exists. (This is because it can be shown that this problem is equivalent to Post Correspondence Problem which is an Undecidable problem)
Now you can try to generate some strings from the grammar and check if there exists at least one string for which more than one parse tree exists( or more than one leftmost derivation exist or more than one rightmost derivation exist) then the CFG is Ambiguous.
If a CFG (without useless symbols) is both left-recursive and right-recursive for the same non-terminal then that CFG is ambiguous. But the converse is false (means an ambiguous CFG may not have both left and right recursion).
CFG = Context-Free-Grammar.
Good read: Ambiguous grammar - Wikipedia
If anyone wants to add something more please comment.