If the previously selected value of B is not meant to be in the list of values for newly selected dropdown A value, then you could set a default value (ie: 'No selection') that the B dropdown should have when first created. In a method to define how you create B, check if current B value is not valid for A, if it is not then create the dropdown widget with the default value.
If the value of B makes sense also when dropdown A changes, try to find a way to figure out if A changed. For example write the code to create B in a cell where you also call dbutils.widgets.get(A). This will run the cell when A changes, then create B with the default value. When running the cell that checks if A changed, also write create_B (input_values, 'No selection').
It's complicated, but follow the logic and you will get there.
def create_B (input_values, default):
values = [value for value in input_values]
if (default not in values):
default = 'No selection'
if ('No selection' not in values):
values.insert(0, 'No selection')
dbutils.widgets.dropdown('widget B', default, values)