One way to do it is by creating a new spreadsheet, moving it to the desired folder and then using copyTo() to copy the sheet to the newly created spreadsheet.
function extractSheetToFolder() {
// Create new spreadsheet
const destinationSpreadsheet = SpreadsheetApp.create('Spreadsheet B');
// Get destination folder based on its ID
const destinationFolder = DriveApp.getFolderById('ABC123');
// Move new spreadsheet to destination folder
DriveApp.getFileById(destinationSpreadsheet.getId()).moveTo(destinationFolder);
// Get the source sheet
const sourceSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet A3');
// Copy source sheet to destination spreadsheet
// The copied sheet will be named "Copy of Sheet A3",
// so rename copied sheet to use the same name as the original sheet
sourceSheet.copyTo(destinationSpreadsheet).setName(sourceSheet.getName());
// Remove default first sheet (called "Sheet1" in English) from new spreadsheet
destinationSpreadsheet.deleteSheet(destinationSpreadsheet.getSheets()[0]);
}