What is the name of your state (only U.S. law)? FL
Can someone posting an ad on craigslist ask for a deposit and your license before allowing to let you test ride the item i.e. motorcycle.
Sure they can. It's not illegal (that I am aware).
If a deposit is given, then the person should receive a signed WRITTEN receipt for the amount of the deposit, clearly explaining what the money was for and that is refundable or can be applied towards the purchase.
As for the driver's license, they can ask to hold that as well. It proves that the prospective buyer is properly licensed and gives the seller some way to track them should they disappear with the bike. (Most car dealers already do this as well.)